CS4ALL Computer Science For All Of Us
  • Home
  • Community
  • Workshop
    • Workshop Info
    • Schedule
    • Location
    • Sponsors
  • Resources
    • Scratch Resources
CS4ALL
  • Home
  • Community
  • Workshop
    • Workshop Info
    • Schedule
    • Location
    • Sponsors
  • Resources
    • Scratch Resources
  • Home
  • Scratch
  • Beginner
  • Repeat

Repeat

July 19, 2016 Leave a Comment Written by Keith Atkinson

In Drawing a square we used the commands “move 50 steps” and “turn clockwise 90 degrees” four times each. To shorten this task we can use the repeat command. Wrapping blocks in a repeat allows us to reuse the logic.

Draw a Circle

A computer can only draw straight lines, but we can create the appearance of a curved line by drawing a bunch of of tiny lines that, when connected together, look like a circle

Since a circle has 360 degrees, we can create a circle by making 360 tiny lines, each one pixel long. After each line is drawn, we turn the pen 1 degree to the right.

What if you wanted to draw a circle to the left? You could repeat the same commands except change the command “right” to the command “left.”

To make the circle bigger we can change the length of line (For example: move 3).
Drawing a Triangle

We can also use the repeat command to easily make an equilateral triangle (a triangle in which the length of all three sides are equal). Since each of the internal angles must also be equal we can create a triangle by rotating the pen 120 degrees after each line is drawn.

Beginner, Scratch
Common Tasks

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *