Using Step with non-constant variable

BlitzMax Forums/BlitzMax Programming/Using Step with non-constant variable

William Drescher(Posted 2008) [#1]
I want to use the code: For I:Int = 0 To MaxNum:Int Step XInterval but I get the error that step expression must be a constant. Is there a way I can use a Global variable for a step expression?


Floyd(Posted 2008) [#2]
The step value must be a constant. Use a While loop instead.

I = 0
While I <= MaxNum
   ' do something
   I :+ XInterval
Wend

You would need to test I >= MinNum if the step value is negative.