For - Next - Step
Posted: Wed Nov 30, 2022 12:27 pm
In the documentation the step must be an constand. But in many Basic programs i see is that the step is not a constant but a integer variable.
Why is this in PureBasic a constant. Can it be made to an Integer variable.
This I found out becaus i try to use the step with a variable but PB will not allow this.
In this peace of code i got the error. Cause dx is not allowed. While dx is a integer. In this code the sprite wil go faster every step the program is comming here.
Why is this in PureBasic a constant. Can it be made to an Integer variable.
This I found out becaus i try to use the step with a variable but PB will not allow this.
Code: Select all
X2=x1+35*dx
dx=dx*4
DisplayTransparentSprite(BombSprite(0),x1,y1)
For i=x1 To X2 Step dx ;<-- this is a variable while PB want it to be a constant
DisplayTransparentSprite(BombSprite(0),i,y1)
DisplayTransparentSprite(BombSprite(0),i + dx,y1)
Next