fastbasic icon indicating copy to clipboard operation
fastbasic copied to clipboard

Multi dimension arrays

Open ukcroupier opened this issue 5 years ago • 4 comments

Apologies if I haven't read the manual properly :)

Does FB have multi-dimension arrays? I tried dim a(9,9) and it threw up an error. I checked manual and it says nothing about it that I can see.

ukcroupier avatar Mar 02 '20 15:03 ukcroupier

Does FB have multi-dimension arrays? I tried dim a(9,9) and it threw up an error. I checked manual and it says nothing about it that I can see.

No, FastBasic does not support multidimensional arrays, this is because arrays are represented with a single pointer to memory, so the interpreter would have no way to know the dimensions and how to access elements.

dmsc avatar Mar 03 '20 18:03 dmsc

No problem, I've just used a variable as a pointer to split a single array into multiple sections. It would be more natural to have multi dimension arrays but it's a simple solution.

Now, if procedures had local variables then that would be the dream :) but i'm guessing that would be more complex for you to sort out than multi dimension arrays.

ukcroupier avatar Mar 03 '20 18:03 ukcroupier

Hi!

No problem, I've just used a variable as a pointer to split a single array into multiple sections. It would be more natural to have multi dimension arrays but it's a simple solution.

Now, if procedures had local variables then that would be the dream :) but i'm guessing that would be more complex for you to sort out than multi dimension arrays.

No, local variables would be easier, I have planed that for v5.0....

dmsc avatar Mar 03 '20 19:03 dmsc

You're an absolute star, I look forward to v5.0

Now I need to go read up about those DLIs, still haven't had time to figure them out - thanks.

ukcroupier avatar Mar 03 '20 19:03 ukcroupier