FOR

From Smart Box
Jump to navigation Jump to search

Syntax[edit]

FOR number TIMES

Description[edit]

The command FOR is used to begin a FOR...NEXT loop. This makes the computer execute a series of lines a specified number of times. The word TIMES is optional. FOR...NEXT loops can be nested up to 40 deep. The maximum loop value is 255.

Example[edit]

To print the value of sensor a 5 times at 1 second intervals.

FOR 5 TIMES
PRINT SENSOR A
WAIT 1
NEXT

Associated keywords[edit]