PC Logo Wiki
Advertisement

Syntax

EACH list

Explanation

EACH causes each of the currently active turtles to executes the commands contains in its argument sequentialy. This allows each of several turtles to be given a variable input or to be addressed by WHO or its current number.

See also ASK, SETTURTLES, TELL, and WHO.

Example

TO MANY.HEADINGS

TELL [0 1 2 3 4 5 6 7]
PENDOWN ST
EACH [SETH 45 * WHO SETPC WHO FD 30]

END

This procedure causes eight turtles to change their color to the same value as their turtle number. They then move apart in different directions.

? MANY.HEADINGS

Pc logo 17

This is a result of the "MANY.HEADINGS" procedure.

?

Advertisement