Doing Things Over (and Over)

In the Last Lesson

We learned how to start RLogo and how to make the turtle draw shapes on the screen.

In this lesson

Remember how we could make a triangle or a square? We had to click (or type) the same commands over and over? Now we will learn about the repeat command. Try drawing a square like this...

repeat 4 [ fd 40 left 90 ]

Isn't that a lot faster?

Use repeat commands to draw a polygon with 7, 10, and 24 sides. Here are some things to think about...

  • How do you figure out how many degrees to turn?
  • To ask the computer to divide, you use the / symbol.
  • What happens with figures with more sides?
  • Can you fix that?
  • What happens if you repeat inside a repeat?

Questions

Just raise your hand and I will help.

Did you know?

You can use repeat statements to draw flowers or stars!

-- PeteJohnson? - 13 Oct 2005

Revision: r1.2 - 18 Dec 2005 - 17:46 - PeteJohnson