FOR
Action

Execute a block of statements a number of times.

Syntax

FOR var = start TO/DOWNTO end [STEP value]

Remarks

var The variable counter to use
start The starting value of the variable var
end The ending value of the variable var
value The value var is increased/decreased with each time NEXT is encountered.
var : Byte, Integer, Word, Long, Single.
start: Byte, Integer, Word, Long, Single, Constant.
end : Byte, Integer, Word, Long, Single, Constant.
step : Byte, Integer, Word, Long, Single, Constant.

For incremental loops you must use TO.
For decremental loops you must use DOWNTO.
You may use TO for a decremental loop but in that case you must use a negative STEP : For a = 10 To 1 STEP -1
You must end a FOR structure with the NEXT statement.
The use of STEP is optional. By default a value of 1 is used.

See also
NEXT , EXIT FOR

Example
y = 10 'make y 10
FOR a = 1 TO 10 'do this 10 times
FOR x = y TO 1 'this one also
PRINT x ; a 'print the values
NEXT 'next x (count down)
NEXT 'next a (count up)

Dim S as Single
For S = 1 To 2 Step 0.1
Print S
Next
END