Logo Help

Commands

When you are programming with Logo you are pretty much talking to a turtle :). You give it commands and it will respond to them by drawing what you tell it to draw. Below is a list of what commands the turtle recognizes.

forward x

This will tell the turtle to move forward x pixels

backward x

This will tell the turtle to move backward x pixels

right x

This will tell the turtle to rotate to the right x degrees

left x

This will tell the turtle to rotate to the left x degrees

pen-up

This will tell the turtle to lift its pen up and stop drawing

pen-down

This will tell the turtle to put its pen on the canvas and start drawing

color x

This tell the turtle to switch to a different colored pen. For example, to make the turtle draw red lines, just write the line “color red“! The available colors for you to choose from are:

red, orange, yellow, cyan, blue, green, purple, brown, pink, black, white, and magenta

thickness x

This command tells the turtle to use a pen that is x pixels wide

cursor x

This command changes the cursor to a different images. Possible values for x are:

0 - No cursor

1 - Arrow

2 - Turtle

3 - Airplane

example: To change the cursor to a turtle write the line “cursor 2

background x

This command changes the background of the canvas to a different image.

0 - blue sky

1 - brown

example: To change the background to brown, write “background 1

speed x

This command will tell the turtle to speed up or slow down. Setting x to 0 will stop the turtle, and setting it to 100 will tell it to go as fast as it can. Any value from 0 to 100 is valid.

 

Loops

One very useful feature of most programming languages is the concept of loops. Loops will tell the computer to repeat certain commands as many times as you want. For example. Say you want to draw 10,000 squares on top of each other, you could manually write out over 80,000 lines of code, but my guess is that that would get boring after a while. Instead, you can use a loop to draw a side and rotate the turtle 80,000 times with only writing 4 lines!

repeat 80000[
forward 20
right 90
]

To use a loop you need to use the repeat command. This is how it is structured:

repeat x[
//everything inside these brackets is repeated x times
]

Comments

If you ever want to make notes to yourself or others in code, you can simply add two slashes and then write whatever text you want. For example if you wanted to tell someone where you were drawing a square you could simply write:

//this is where I am drawing the square

Copyright © 2007 - Cody CAN. All rights reserved.