Vtech Power Zone 2000 User Manual - Page 36

variables

Page 36 highlights

end 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 would 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 instruction forward (fd) n back (bk) n left (lt) n right (rt) n setx n sety n setxy x,y setheading (seth) n setpc n setbg n pencolor(pc) background(bg) penup (pu) turtle goes forward N steps. turtle goes back N steps. rotate the turtle left (counterclockwise) N degrees, one step/unit(one unit = 22.5 degrees). rotate the turtle right (clockwise) N degrees, one step/unit(one unit = 22.5 degrees). turtle goes to X = N coordinate. turtle goes to Y = N coordinate. turtle goes to (x,y) coordinate. turn the turtle N degrees (clockwise), one step/unit(one unit = 22.5 degrees). set the pen color to N(N = 0 ~ 3). set the background color to N(N = 0 ~ 3). get the current color of pen. get the current background color. put the turtle's pen up. When the turtle moves, it does not draw a line. 28

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47

28
end
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 would 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 instruction
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, one step/unit(one unit = 22.5
degrees).
right (rt)
n
rotate the turtle right (clockwise) N degrees,
one step/unit(one unit = 22.5 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),
one step/unit(one unit = 22.5 degrees).
setpc
n
set the pen color to N(N = 0 ~ 3).
setbg
n
set the background color to N(N = 0 ~ 3).
pencolor(pc)
get the current color of pen.
background(bg)
get the current background color.
penup (pu
)
put the turtle’s pen up. When the turtle
moves, it does not draw a line.