QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: 40wattstudio on March 08, 2020, 02:16:55 pm
-
Hi everyone!
I've heard of nested loops in QBasic, but is there a way to implement nested arrays (which I understand to be one array inside of another)?
-
Hi everyone!
I've heard of nested loops in QBasic, but is there a way to implement nested arrays (which I understand to be one array inside of another)?
Yes there is a way, it will take some cleverness on your part here is a great tool for doing this:
https://www.qb64.org/forum/index.php?topic=1607.0
Use different delimiters to break string into elements (sub strings) which are in turn broken by a different delimiter. Is it JS that splits first by ";" and then by "," ? ( or vice versa)
I also have a Word tool that could be applied for this task.
I don't know what QBasic had but this method could be applied in any decent PL.
I have used this method to save (x, y) point locations in Type definition with non fixed String (but you can't save this Type element to file).
-
There are of course multidimensional arrays. But yeah - if you're looking for abstract arrays in arrays, you probably need to dip into string space.
HOWEVER... I really wish we had a developed section on linked lists right now, those would handle this to a tee. Maybe I'll hit that soon.
-
Thanks for the feedback bplus and STxAxTIC!
I'll try that tool and see if I can get it to work. In my case though I'm just dealing with integers and not strings. Hopefully that means it'll be easier since I'm dealing with just the one datatype.
Fingers crossed!