Instruction manual
26
Variables
Logo can interpret a string of characters in four ways:
1. Numeric value
The strings “123” and “25.6” are recognized as numeric values.
2. Command
The strings “square” and “triangle”, when created in the routines defined
above, are recognized as commands.
3. Text
To print the word “house”, if one writes print house, Logo sees the word
“house” as a command. To enable Logo to treat the word “house” as text,
there must be double quote marks placed immediately before it. It also can
be written as print “house".
4. Variable name
Placing a colon “:” before a word enables Logo to read the word as a variable. In
the example above, “forward :n” enables Logo to read “:n” as a variable and
use it as input to the command “forward.”
1. Drawing Commands
forward (fd) n turtle goes forward N steps.
back (bk) n turtle goes back N steps.
left (lt) n rotate the turtle left (counterclockwise) N degrees.
right (rt) n rotate the turtle right (clockwise) N degrees.
setx n turtle goes to X = N coordinate.
sety n turtle goes to Y = N coordinate.
setxy x y turtle goes to (x,y) coordinate.
setheading (seth) n turn the turtle N degrees (clockwise) from the
straight up position.
setpc n set pen color to N(N = 0,1). (0=white, 1=black).
setbg n set background color to N(N = 0, 1). (0=white,
1=black).
pencolor (pc) get current color N of pen(N=0,1). (0=white,
1=black).
background (bg) get current background color N(N=0, 1). (0=white,
1=black).
penup (pu) put the turtle’s pen up. When the turtle moves, it
does not draw a line.
pendown (pd) put the turtle’s pen down and draws a line when
the turtle moves.(default status)
showturtle (st) make the turtle shape visible.(default status)
hideturtle (ht) make the turtle shape invisible.