Boriel Basic Forum
ARRAY of STRING (solved) - Printable Version

+- Boriel Basic Forum (https://forum.boriel.com)
+-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://forum.boriel.com/forumdisplay.php?fid=16)
+---- Thread: ARRAY of STRING (solved) (/showthread.php?tid=2353)



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

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 - 2023-03-18

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 - 2023-03-19

And instead of
Board$(2,3)

I should use
Board$(2)(3)