Difference between 'To' and 'Until'
BlitzMax Forums/BlitzMax Programming/Difference between 'To' and 'Until' The first loop will loop through 0,1,2,..8,9,10, the second 0,1,2,..8,9.
For a = 1 Until x
Is equivilant to
For a = 1 To ( x - 1 )
Except that Until should be ever so slightly faster.
For a = 1 Until x
Is equivilant to
For a = 1 To ( x - 1 )
Except that Until should be ever so slightly faster.
thats cool because arrays start at 0.
array[amount]
you would want to loop 0 to (amount-1)
array[amount]
you would want to loop 0 to (amount-1)
For/Until skips the last loop. Its main use is for iterating through zero-based data (eg. 5 items with values 0, 1, 2, 3, 4) without having to remember to use -1 on the end value -- you just go For a = 0 Until 5 to iterate through 5 zero-based items.
Hmm... Not so sure if that is actually useful, but ok. :^/ Useful perhaps in some cases, but just weird enough to confuse the newbie (and also not explained in the manual...)
But thanks for the reply!
Russell
But thanks for the reply!
Russell
I use Until probably more than I use To. It's second to none when you're working with arrays.
I guess I've just gotten so used to doing it the 'old' way... Darn progress! ;)
Russell
Russell
I've been using BLtiz for years and I didn't even know you could do that. I wouldn't use it. I'm old frashined that way.
Seems kind of silly for it to even be there.
[edit]
Pfft, I'm reading the BlitzMax forum... no wonder. :-)
STILL SILLY TO ADD IT.
[/edit]
Seems kind of silly for it to even be there.
[edit]
Pfft, I'm reading the BlitzMax forum... no wonder. :-)
STILL SILLY TO ADD IT.
[/edit]