bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Allow non-const values for Step

Open woollybah opened this issue 5 years ago • 2 comments

BlitzMax currently has a limitation that only allows for constant values for the Step counter of a For loop.

I don't see any reason why the following code shouldn't be allowed :

SuperStrict

Framework brl.standardio

Function loop(total:Int, steps:Int)
	For Local i:Int = 0 Until total Step steps
		Print i
	Next
End Function

Much like how total is evaluated once at the initialisation of the loop, I think we could easily apply the same logic to the Step value, making it effectively constant for the iteration.

woollybah avatar Dec 03 '19 06:12 woollybah