Image of LOGO LOGO

Lesson 6: Loops

     English   Deutsch   Français
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.

[_Home_] [_Introduction_] [_Java_Help_] [_Download_] [_Learn_Logo_] [_Program_] [_Teacher_] [_Contest_] [_Discussion_] [_Procedures_] [_Perspective_] [_About_]

©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.

Your browser does not support Java. Please read the text on the left side of this page about Java. If you work without Java you will have to use the HTML menu below this text.
[1_First_steps] [2_Turn_left_turn_rigth] [3_With_colors] [4_Procedures] [5_Parameters] [6_Loops] [7_More_parameters] [8_Stars] [9_Upload_and_Download] [10_LOGO_learns_to_write]

And we will continue to improve LOGO programming. Are you already tired of typing the same thing again and again ? So you will be interested in the command repeat (or re). You use it exactly like the command goto, except that you tell LOGO how often he is supposed to repeat the procedure.

The procedure square will look as follows:

procedure main
goto square
end

procedure square
repeat 4,go_and_right
end

procedure go_and_right
go 100
rt 90
end

The procedure main just tells LOGO to draw the square. In the procedure square you will find the essential command repeat drawing four times the procedure go_and_right which only draws one side of the square and turns 90 degrees, thus setting LOGO in the right position for the next side.

Look at it again in step-by-step view and you'll see how this produces a square.

Now you can try to draw another village using your procedure house and the command repeat. If anything doesn't work as you wanted it to, make sure that after each house LOGO is in the right position and looks in the right direction to draw the next one.

Using the example of the procedure square that we gave you, try to change the value of the angle to 120, 72, 60, 45 or 30 and to find out the number of repetitions needed by LOGO to regain the point where he started. You may also change the value behind go and see what it changes.

lesson 5«------» lesson 7

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.