Forum
DIM a$(100,10) possible bug? - 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: DIM a$(100,10) possible bug? (/showthread.php?tid=1027)



DIM a$(100,10) possible bug? - RandomiserUsr - 02-26-2021

Hi, 

I have been developing a game and one of thing things I wanted to is build up a string and print it out but the issue I have is that I can't do the following code in zxbc :-


Code:
DIM a$(100,10)
LET a$(1) = "Line 1"
PRINT a$(1)

But I can do the above in a ZX Spectrum emulator.

I know the solution is to use a$(1,1) (Ignore the zero array start)

PS Brilliant compiler!! 

Thanks,
Ken


RE: DIM a$(100,10) possible bug? - boriel - 02-28-2021

(02-26-2021, 08:03 PM)RandomiserUsr Wrote: Hi, 

I have been developing a game and one of thing things I wanted to is build up a string and print it out but the issue I have is that I can't do the following code in zxbc :-


Code:
DIM a$(100,10)
LET a$(1) = "Line 1"
PRINT a$(1)

But I can do the above in a ZX Spectrum emulator.

I know the solution is to use a$(1,1) (Ignore the zero array start)

PS Brilliant compiler!! 

Thanks,
Ken

Yes. DIM a$(N, length) is not supported.
You have to do DIM a$(N) and if you want fill the 100 slots with "          " (10 spaces).

Also, for better compatibility with Sinclair BASIC, compile with --sinclair


RE: DIM a$(100,10) possible bug? - RandomiserUsr - 02-28-2021

(02-26-2021, 08:03 PM)RandomiserUsr Wrote: Hi, 

I have been developing a game and one of thing things I wanted to is build up a string and print it out but the issue I have is that I can't do the following code in zxbc :-


Code:
DIM a$(100,10)
LET a$(1) = "Line 1"
PRINT a$(1)

But I can do the above in a ZX Spectrum emulator.

I know the solution is to use a$(1,1) (Ignore the zero array start)

PS Brilliant compiler!! 

Thanks,
Ken

(02-28-2021, 05:19 PM)boriel Wrote:
(02-26-2021, 08:03 PM)RandomiserUsr Wrote: Hi, 

I have been developing a game and one of thing things I wanted to is build up a string and print it out but the issue I have is that I can't do the following code in zxbc :-


Code:
DIM a$(100,10)
LET a$(1) = "Line 1"
PRINT a$(1)

But I can do the above in a ZX Spectrum emulator.

I know the solution is to use a$(1,1) (Ignore the zero array start)

PS Brilliant compiler!! 

Thanks,
Ken

Yes. DIM a$(N, length) is not supported.
You have to do DIM a$(N) and if you want fill the 100 slots with "          " (10 spaces).

Also, for better compatibility with Sinclair BASIC, compile with --sinclair

Thanks for confirming this :-)