I am having difficulty passing a list to a subroutine (embarrassment); I get a compiler error. I have followed the BASIC-256 documentation on arrays (http://doc.basic256.org/doku.php?id=en:arrays) and included the []
brackets in the subroutine argument as required:
subroutine print_list(list) # or subroutine print_list(list[]) <----- **compiler** error occurs here
for element=0 to list[?]-1
print list[element]
next element
end subroutine
subroutine main()
list = {5.9, 6.0, 5.9, 5.7, 5.6, 5.7}
call print_list(list[]) # <----- **compiler** error occurs here
end subroutine
call main()
The compiler complains that I have an error in the subroutine call argument part.
I have tried fixing this by; (i) checking my initialization of the list; (ii) checking the subroutine definition and parameters (compiler doesn't like the square brackets there either); (iii) excluding the []
brackets from the argument and (iv) tried contacting the BASIC-256 Facebook page.
Thank you for your time....