Dolist

dolist range instruction-list

Runs the instruction list for each item in a list. The first input, range, is a list with a temporary variable name and a list of items. The second input is a list of instructions that uses the variable name included in the first input. In the following example, the instruction remove :i is run for each item of the first list. "I" successively takes the value t1, t2, and t3.

Example:

If there are three turtles on the page, the following instruction removes all three turtles.

dolist [i [t1 t2 t3]] [remove :i]

The following example displays a, b, c, and d in the Command Center.

dolist [i [a b c d]] [show :i]