From QB64 Wiki
Revision as of 23:43, 4 September 2009 by imported>Clippy
Jump to navigation Jump to search

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

Screen Reasults:

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 previous graphics object's placement.


Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage