Getting Started

A quick lesson in Logo

Logo's best known feature is the turtle, a triangular cursor used to create graphics. Even young children quickly learn to move and turn the turtle using easily-remembered, intuitive commands. For example, typing forward 50 moves the turtle forward 50 pixels (screen dots). Typing right 90 turns the turtle right (clockwise) 90 degrees.

By combining these commands, it is easy to draw a square.

forward 50 (You can also abbreviate forward as fd.)
right 90 (You can also abbreviate right as rt.)
forward 50
right 90
forward 50
right 90
forward 50
right 90

Using repeat, you can combine commands to form patterns. Here is the same square design drawn using one instruction line:

repeat 4 [forward 50 right 90]

Because Logo is an extensible language, you can add new commands by creating short programs or sets of instructions called procedures. For example, here is the procedure that will draw our familiar square:

to square
repeat 4 [forward 50 right 90]
end

 

Now, to draw a square, simply type square. You can use the word square as you would any other Logo command, even including it in other procedures. Procedures are the building blocks of larger programs. For example, here are some ways you can use the square procedure.

 

You could draw a flag:

forward 60
square
back 60

 

 

 


You could make a circle of squares:

repeat 12 [square right 30]

 

 

 

 

 

 

You could combine a square and a triangle to build a house (typing house to draw it).

to house
square
forward 50
right 90
triangle
end

to triangle
repeat 3 [forward 50 left 120]
end

 

You can also use a name to represent the size of the square.

to sq :size
repeat 4 [forward :size right 90]
end

 

Now you can draw squares of different sizes by typing:

 

sq 10, sq 20, sq 30, etc.

The design below was created using two procedures that are more complex. They use procedure inputs to represent the line lengths and turning angles, recursion to call the same procedure again, and a conditional statement to make the procedure stop. You would enter the name of the main procedure design to run the program.

to design
clearscreen
right 30
polyspi 5 120
end

to polyspi :size :angle
if :size > 205 [stop]
forward :size
right :angle
polyspi :size+5 :angle+.12
end

As you can see, just using turtle graphics, you can progress from drawing simple shapes with easy-to-learn commands to creating complex figures using quite sophisticated programming techniques. While turtle graphics are an excellent way to begin to learn Logo, you should view them as an introduction and building block, not as the end of a learning adventure. There is so much more that you can do with Logo!

Shopping Cart Links My Account