Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Declare an array type
#1
How do you declare an array type? I supposed it should be easy to find in the docs, but didn't have any luck. For instance:
Code:
sub doThis(v as string?)
    print( v( 0 ) )
endsub
I'm certain it is not string() (I have tried that). I wonder if I have to use DIM again?
Thanks,
-- Baltasar
-- Baltasar
Reply
#2
I think you mean passing an array as a parameter.
This is indeed a bit hidden in the docs: https://zxbasic.readthedocs.io/en/docs/byref/

The syntax is
Code:
Sub doThis(v() as String)
  ...
End Sub

Note that v() can be ANY array of strings of ANY dimensions. You'll have to use LBOUND and UBOUND to retrieve the dimensions of the array if you are expecting arrays of different dimensions.
---
Boriel
Reply
#3
Great, thanks!!
-- Baltasar
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)