![]() |
2D Array Errors - 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: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: 2D Array Errors (/showthread.php?tid=2610) |
2D Array Errors - raymondlesley - 02-13-2025 I've been enjoying using ZX BASIC so far. It's great to have something that's easy to use (and in-keeping with the original Sinclair BASIC). I have come up against an issue which I can't find a solution for: The compiler supports multi-dimensional arrays, but it throws an error if I attempt to get a "slice" of the data. My code: Code: DIM data_array(0 TO 2, 0 TO 3) AS UByte = { _ I get no errors relating to element12 I would expect that element0 should result in {0, 1, 2, 3}. It's the right "shape". Instead I get an error: Quote: I've tried variants e.g. data_array(0, : ) or data_array(0,0 TO 3). Nothing seems to work. I'm using ZX BASIC 1.17.2 RE: 2D Array Errors - boriel - 02-16-2025 Was that feature actually allowed in Sinclair Basic?? The error is expected. You cannot do that, only copying entire arrays (of the same dimension) onto another. However it's a nice feature. Will thing of implementing it... In the meantime, you can create a function to do this (arrays can be passed as parameters) or do it directly at low level: Code: #include <memcopy.bas> |