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



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

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 - 2021-02-28

(2021-02-26, 09: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 - 2021-02-28

(2021-02-26, 09: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

(2021-02-28, 06:19 PM)boriel Wrote:
(2021-02-26, 09: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 :-)