Question about For loops...

BlitzMax Forums/BlitzMax Beginners Area/Question about For loops...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm pretty sure it is possible to make one's own list type which you can iterate through using For Each, by including a special method in your type.

But is it possible to do the same thing with For X = Y to Z Next? Are there methods which you can put in a type which would allow you to make a list type, and then pass two link pointers as Y and Z, and have Next set X to the next link each time, until it reaches Z? This would be much more convenient than having to do While loops all the time.

If it does work, I wonder if you could make it work properly with Null being passed for both Y and Z. With integers if you pass 0 and 0 then it will loop once, but you don't want it to loop once if the value passed is Null.