### Lesson 2: Turn left turn right

Your browser does not support Java for the moment. In order to use this page we strongle suggest that you go to the "Java Help" page. Please choose "Java_Help" in the small menu below. It's possible to use our page without Java but then you will have to download a Logo interpreter from our "Download" page.

©1997/1998 Sebastian Golze, Thomas Hirsch und
Vinh Hoi Le Chau
. Please mail us if you had problems with our site os if you have any other suggestion.

Now you should be able to tell LOGO to go forward. Of course that's not all he can do. In this lesson you will learn the commands that tell him to turn right or left.

Here is another little program that tells LOGO to draw a square.

procedure main
go 100
right 90
go 100
right 90
go 100
right 90
go 100
right 90
end

Indeed, when you execute this program, LOGO draws a square. You have certainly already seen the command which makes him turn: it's the command right. So why do we have that number beside ?

This number tells him how far he's supposed to turn. You, for example, can turn yourself a whole turn, half a turn, and so on. But this number is more precise: It declares an angle measured in degrees. Hey, that doesn't have anything to do with temperatures!

A whole turn consists of 360 degrees. So half a turn is 180, and a quarter turn is 90 degrees. This explains why there's a 90 besides the command right: LOGO turns a quarter turn to the right every time this command is executed . If he repeats this four times and walks a little distance forward after each turn, he draws a square. If you want to, you may try it out yourself - but don't draw on the carpets !

Now turn to the other side:

procedure main
go 100
left 90
go 100
left 90
go 100
left 90
go 100
left 90
end

Look at the two examples again while executing the program step by step. At the end, LOGO does a last turn, so that he looks in the same direction as in the beginning. You should always let him do that in order to know where he looks even if he has repeated a procedure several times.

Now try what happens when you enter other numbers after the word right. Use for example the values of 30, 45, 60, 120, 180, 270 or 360.

Maybe you'll want to draw some simple figures now. A rectangle, a triangle or a cross should do it for the beginning. First, try to draw the figure with a pencil on paper using only one line. Now you translate every line and every corner into a move or a turn of LOGO.

If you don't want to write so much, there are abbreviations for the words right and left: LOGO also understands the words rt and lt

lesson 1«------» lesson 3

Your browser does not support Java. With Java you would see here Logo sitting on his sheet of paper and the Logo interpreter. You have to activate Java or to use an external interpreter (which works exactly like this one) you can get at our "Download" section.