![]() |
Pass an Array to a Sub - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +--- Thread: Pass an Array to a Sub (/showthread.php?tid=929) |
Pass an Array to a Sub - XoRRoX - 04-02-2020 Hello all, I'm pretty new to ZX Basic so please forgive my possible beginner questions. I'd like to pass an Array to a Sub but cannot seem to figure out how. Code: dim SortArray(10) as string Thanks in advance for any insights ![]() RE: Pass an Array to a Sub - XoRRoX - 04-04-2020 Sorry, my example was unclear. I'd like to pass an array to the routine to be able to re-use it in the same application and also to be able to put it in a library. So, perhaps I should have presented it like this: Code: dim MyArray(10) as string RE: Pass an Array to a Sub - boriel - 04-04-2020 (04-04-2020, 08:26 AM)XoRRoX Wrote: Sorry, my example was unclear. ZX Basic does not support (yet) passing arrays by parameter. It's planned, however, but not easy to implement. Some people use macros (#define ...., like in C, which are allowed) or use global variables for the moment. I will update when it's implemented. RE: Pass an Array to a Sub - XoRRoX - 04-08-2020 Cool - thanks ![]() RE: Pass an Array to a Sub - boriel - 12-08-2020 ZX Basic now supports passing array as parameters! ![]() Code: SUB SelectionSort (ByRef SortArray() as String) If you don't use ByRef it will be enforced anyway. |