The STEP keyword is used in FOR...NEXT loops to skip through the count or to count down instead of up. Used in graphics to designate a relative coordinate position of a graphics object function.
FOR Syntax: FOR counter_variable = start_point TO stop_point STEP interval
- A counter variable is used to designate the FOR value. Must be the same number type as the start and stop point values.
- Start and stop point values can be any number type values or variables.
- STEP interval designates the portion to add or subtract from the variable value.
- When the STEP interval is negative, then the start value should be greater than the stop value.
Example: Countdown loop
- FOR i = 10 TO 0 STEP -2
- PRINT i;
- 10 8 6 4 2 0
Note: The value of i = -2 after the loop is done.
Graphics Syntax: LINE STEP(column1%, row1%)-(column2%, row2%), color_attribute%
- STEP can be used with the LINE, CIRCLE, PSET, PRESET or PAINT graphics object functions.
- STEP coordinate positions are relative to the last graphics object's placement.