Forum
ARRAY of STRING (solved) - 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)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: ARRAY of STRING (solved) (/showthread.php?tid=2353)



ARRAY of STRING (solved) - zarsoft - 03-18-2023

I'm a bit confused.

How do I do this?

DIM Board$(3,4)
LET Board$(1) = "ABCD"
LET Board$(2) = "EFGH"
LET Board$(3) = "IJKL"


RE: ARRAY of STRING - boriel - 03-18-2023

You can do that as in normal Sinclair BASIC. Use READ, DATA:

Code:
DIM Board$(3): REM You don't need to specify the max length of each row.
DIM i As UInteger
FOR i = 1 TO 3
    READ Board(i)
NEXT i

DATA "ABCD", "EFGH", "IJKL"



RE: ARRAY of STRING - zarsoft - 03-18-2023

And instead of
Board$(2,3)

I should use
Board$(2)(3)