FOR
Syntax FOR word number number runlist 
(FOR word number number runlist number) 
 
Explanation FOR allows you to execute a list of Logo commands a specified number of times. Inputs to FOR are a control variable, a beginning value, an ending value, and a list of Logo commands to be executed. FOR assigns the beginning value to the variable, executes the instruction list, increments the variable by one, checks to see if the variable is equal to or greater than the ending value, and then repeats the process until the value of the variable equals or exceeds the ending value.

The variable increment step can be changed to a number other than one by listing the increment as a fifth input to FOR and enclosing FOR and all its inputs in parentheses.

See also FOREACH and REPEAT.
 

Examples FOR "I 1 4 [PRINT :I] 




(FOR "I 1 4 [PRINT :I] 2) 

TopIndex