Single-line FOR loop?

BlitzMax Forums/BlitzMax Beginners Area/Single-line FOR loop?

PoliteProgrammer(Posted 2012) [#1]
Hi everyone, just a quick question:
You know how it's possible to write single-line IF statements, e.g.
If ( x < y) Print "x is less than y"
Well, is it possible to do single-line FOR loops? Something like:
For ( local i:int = 1 to 10 ) print array[i]
would be very handy, but it doesn't compile for me. Any suggestions?
Thanks in advance!

Edit:
For local i:int = 1 to 10 ; print array[i] ; next
works, but looks kind of ugly.

Last edited 2012


Scaremonger(Posted 2012) [#2]
This works too:
For Local i:Int = 1 To 10 Print array[i] Next