04-02-2020, 09:30 AM
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.
Thanks in advance for any insights
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
SUB SelectionSort (SortArray) 'Compile Error: Syntax Error. Unexpected token 'SortArray' <ARRAY_ID>
{Code}
END sub
'************************ Main ****************************
Let SortArray(0) = "Line 00"
Let SortArray(1) = "Line 02"
Let SortArray(2) = "Line 08"
Let SortArray(3) = "Line 06"
Let SortArray(4) = "Line 01"
Let SortArray(5) = "Line 03"
Let SortArray(6) = "Line 07"
Let SortArray(7) = "Line 04"
Let SortArray(8) = "Line 05"
SelectionSort(SortArray) ' Compile Error: Variable 'SortArray' is an array and cannot be used in this context
Thanks in advance for any insights