Lessons For Logo Lovers - Lesson 2


By now, you have probably thought about and created:
  • square
  • Rectangle
You had to do quite a bit of figuring out. You should be seeing a pattern, or connection, between the number of sides and the RT. Think about that pattern now. Use what you are beginning to learn about the pattern to create the following:
  • Pentagon - 5 Sides
  • Hexagon - 6 Sides
  • Octogon - 8 Sides
  • Nonogon - 9 Sides
  • Decagon - 10 Sides
Now the pattern is probably more obvious. But... your hand is probably getting tired!
You have been typing the same CARs over and over, just to draw something with 10 sides!
Now is a good time to learn a pretty important CAR:

REPEAT


The REPEAT is very powerful. With REPEAT, you tell the computer how many times something should be done. You can have many commands as part of REPEAT.

Everything that you want to REPEAT is enclosed in brackets - [ ].

The format of the command is:

REPEAT n [command command command]

n is the number of times. command is what you want the turtle to do.

Use REPEAT to draw your square and rectangle.

Notice what is different about the commands.

Clear the screen.
Use REPEAT to draw a square.
Use REPEAT again, but use BK instead of FD. See what happens!

Now something else.
Here is a star. The turn is 135.
Write the REPEAT to draw this star.


Top Of Page

Return to Main Page