LOGO Primitives
Command |
Short Form |
Example |
Description |
||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
ALLTURTLES |
|
|
ALLTURTLES outputs a list of the numbers of every turtle that currently defined in Logo. ALLTURTLES is equivalent to the command EVERY "TURTLE. |
||||||||||||||||||||||||
TURTLES |
|
|
The TURTLES command reports the total number of available turtles. |
||||||||||||||||||||||||
WHO |
|
|
WHO reports the list of currently active turtles as set by the TELL command. Turtle numbers are reported, even if the turtles have been assigned names. |
||||||||||||||||||||||||
.WHO |
|
|
.WHO reports a list of currently active turtles as set by the TELL command. Turtle numbers are reported, even if the turtles have been assigned names. The list reported by TURTLENAMES can help you match turtle names and numbers. .WHO always outputs a list, unlike WHO, even if there is only one Logo object listening. |
||||||||||||||||||||||||
TURTLENAME |
TNAME |
|
TURTLENAME reports the name of the first active turtle. The turtle has a default name of the form TURTLE.n, where n is the turtle number. |
||||||||||||||||||||||||
TURTLENAMES |
TNAMES |
|
TURTLENAMES reports a list of the names of all available turtles. A turtle with no name is represented by the empty list. |
||||||||||||||||||||||||
SETTURTLENAME number word |
SETTNAME number word |
SETTURTLENAME 0 "BOAT |
SETTURTLENAME
takes a turtle number and a word as input and assigns that name to the given
turtle. After naming turtles, you can refer to them by their numbers or
names. |
||||||||||||||||||||||||
ASK number list |
|
ASK 1 [ST FD 50] |
ASK
causes the turtle(s) named in its first argument to execute the commands in
its second argument. ASK makes it possible to send commands to a turtle that
is not currently active without making it one of the active turtles. |
||||||||||||||||||||||||
TELL number |
|
TELL 0 FD 50 TELL “ARROW TELL [0 1 2 3 4 5] |
TELL
activates the objects that respond to turtle commands. Objects may either be
turtles, bitmaps or controls. A single number as an argument to TELL
activates that single turtle. A list of numbers or names activates all
the turtles, bitmaps or controls named in the list. |
||||||||||||||||||||||||
TELLALL number number |
|
TELLALL 0 15 RT 90 FD 50 |
TELLALL
activates a range of turtles to respond to turtle commands. TELLALL takes two
numbers as arguments. The first number is the number of the first turtle in
the range to be activated. The second number is the last turtle in the range
to be activated. Use TELL to activate a single turtle or a list of turtles. |
||||||||||||||||||||||||
TELLEVEN |
|
TELLEVEN SETH 90 |
TELLEVEN
activates all the even numbered available turtles. |
||||||||||||||||||||||||
TELLODD |
|
TELLODD SETH 270 |
TELLODD
activates all the odd numbered available turtles. |
||||||||||||||||||||||||
EACH list |
|
EACH [SETPC RANDOM 14] |
EACH
causes each of the currently active turtles to execute the commands contained
in its argument sequentially. This allows each of several turtles to be given
a variable input or to be addressed by WHO or its current number. |
||||||||||||||||||||||||
SETTURTLES number |
|
SETTURTLES 4 |
SETTURTLES
erases all of your turtles and then defines the total number of new turtles
available. Their numbers range from 0 to the input of SETTURTLES minus 1. For
example, SETTURTLES 16 will create the turtles [0 1 2 3 4 5 6 7 8 9 10 11 12
13 14 15]. By default, Logo starts with 16 turtles defined and turtle 0
activated. SETTURTLES creates
turtles with the following characteristics:
|
||||||||||||||||||||||||
NEW “TURTLE |
|
NEW “TURTLE |
Allows
you to create an additional turtle if you didn’t create enough turtles using
the SETTURTLES command. |
||||||||||||||||||||||||
DECLARE “TURTLE “SKIER |
|
DECLARE “TURTLE “SKIER |
Allows
you to create an additional turtle if you didn’t create enough turtles using
the SETTURTLES command while giving the turtle a name. |