Vtech Power Zone Plus Desktop User Manual - Page 35
Variables, Drawing Commands, the example above
View all Vtech Power Zone Plus Desktop manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 35 highlights
right 30 repeat 3 [forward :n right 120] left 30 end After the routines for a square and a triangle have been defined, a routine to draw a simple house can be made from a square with a triangle on top: to house :n square :n forward :n triangle :n back :n 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 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 back (bk) n left (lt) n right (rt) n setx n sety n setxy x y setheading (seth) n turtle goes forward N steps. turtle goes back N steps. rotate the turtle left (counterclockwise) N degrees. rotate the turtle right (clockwise) N 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) from the straight up position. 27