# for

## Syntax

    for variable = startValue to endValue step stepValue

## Description

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.

## Example

    rem example 1
    for t = 1 to 10
        print ( t )
    next t

    rem example 2
    for t = 1 to 10 step 2
        print ( t )
    next t