step Statement

Purpose:

Optional part of a for loop

Syntax:

step x

Comments:

where x is a increment or decrement.  The step statement also allows for backward loops by using a decrement value

 

Example:

for j  = 1 to 5 step 2; p j; next

1

3

5

 

Reverse loop

 

for j = 5 to 1 step -2; p j; next

5

3

1