for-next step by variable

BlitzPlus Forums/BlitzPlus Programming/for-next step by variable

julianbury(Posted 2004) [#1]
I really need to do a for-next loop with a variable stepsize.

To be clear, the stepsize would not change as the loop runs.

The stepsize is set before the loop runs.

Can anyone suggest a way of spoofing the BlitzPlus-required constant value?

I dread the idea that I might be forced to select among a zillion fornext loops :-(

What a silly restriction!

Thank you in anticipation of any help you can offer.


WolRon(Posted 2004) [#2]
You can't use variables in For-Next loops but you can do this:
For loop = start to quit Step incr
	;do stuff here
Next
becomes...
loop = start + incr
Repeat
	;do stuff here
	loop = loop + incr
Until loop > quit

Note that you may need a seperate loop if your increment is a negative value.