Loop based on an expression.
For <variable> = <start> To <stop> [Step <stepval>]
statements
...
Next
Parameters
variable | The variable used for the count. |
start | The initial numeric value of the variable. |
stop | The final numeric value of the variable. |
stepval | [optional] The numeric value (possibly fractional) that the count is increased by each loop. Default is 1. |
Remarks
For...Next statements may be nested. The For loop terminates when the value of variable exceeds the stop threshold. If stepVal or stop is a variable, its value is only read the first time the loop executes.
Related
ContinueLoop, ExitLoop
Example
For $i = 5 to 1 Step -1
MsgBox(0, "Count down!", $i)
Next
MsgBox(0,"", "Blast Off!")