for variable = startValue to endValue step stepValue
This command will define a program loop that will loop a finite number of times. The for command requires a variable and two values to begin the loop. The variable stores the start value, and is incremented each loop until it reaches the end value. The size of the increment is determined by the step value. The next command is placed to mark the end of the loop. As the variable increments during the loop, you can use its value in many ways. Optionally, you can count in descending order by specifying a high first number, a low second number and a negative step value. The exit command can be used to exit a for loop.
rem example 1 for i = 1 to 5 step 1 print ( i ) next i
rem example 2 for j = 1 to 50 step 10 print ( j ) next j