Learn Without Walls
← Previous Lesson Lesson 4 of 4 Practice Activities →

Lesson 4: Patterns in Scratch

About 15-20 minutes -- Computer lesson

What You Will Learn

By the end of this lesson, you will be able to:

The Repeat Block

In Lesson 3, you learned that a loop repeats instructions. Now it is time to use a real loop in Scratch! The repeat block is one of the most powerful blocks in Scratch.

Step-by-Step: Find the Repeat Block

  1. Open Scratch at scratch.mit.edu and click "Create."
  2. In the Blocks Palette on the left, click on the "Control" category. It is orange.
  3. Find the block that says "repeat 10". It has a special shape -- it wraps around other blocks like a mouth.
  4. Drag it into the Coding Area. Notice the opening in the middle where other blocks can go inside.

Repeat Block: A Scratch block that runs the blocks inside it a set number of times. The number tells it how many times to repeat. You can change this number to any amount you want.

Step-by-Step: Your First Loop

  1. Drag a "when green flag clicked" block from Events into the Coding Area.
  2. Snap a "repeat 10" block from Control below it.
  3. From Motion, drag a "move 10 steps" block and put it INSIDE the repeat block (in the mouth-shaped opening).
  4. Click the green flag. The cat moves 10 steps, 10 times -- that is 100 steps total!

You just used one "move" block to make the cat move 100 steps. Without the repeat block, you would need 10 separate "move" blocks. That is the power of loops!

Talk About It

Ask your child: "How is the repeat block like what we talked about in Lesson 3? Remember the Robot Game -- instead of saying STEP FORWARD ten times, you can say REPEAT 10 TIMES: STEP FORWARD. The repeat block does exactly that!"

Drawing with the Pen

To see patterns on the stage, we need a way to draw. Scratch has a special set of blocks called "Pen" that let sprites draw lines as they move, like holding a marker on paper.

Step-by-Step: Add the Pen Extension

  1. Click the blue "Add Extension" button in the bottom-left corner of the screen (it looks like a block with a plus sign).
  2. Click on "Pen" from the list of extensions.
  3. New green pen blocks will appear in your Blocks Palette!

Step-by-Step: Draw a Line

  1. Start with a "when green flag clicked" block.
  2. Add an "erase all" block from Pen (this clears old drawings).
  3. Add a "pen down" block from Pen (this puts the pen on the paper).
  4. Add a "move 100 steps" block from Motion.
  5. Click the green flag. The cat draws a line as it moves!

"Pen down" means the sprite will draw wherever it goes. "Pen up" means the sprite moves without drawing (like lifting a marker off the paper).

Drawing a Square with a Loop

Now let us combine the repeat block with the pen to draw a shape. Think about what a square is: four sides, all the same length, with a 90-degree turn between each side. That sounds like a pattern!

The Pattern in a Square

To draw a square, you do this:

  1. Move forward
  2. Turn right 90 degrees
  3. Move forward
  4. Turn right 90 degrees
  5. Move forward
  6. Turn right 90 degrees
  7. Move forward
  8. Turn right 90 degrees

See the pattern? "Move forward, turn right 90 degrees" repeats 4 times. That means we can use a loop!

Step-by-Step: Draw a Square

  1. Start with "when green flag clicked"
  2. Add "erase all" from Pen
  3. Add "pen down" from Pen
  4. Add "repeat 4" from Control (change the number from 10 to 4)
  5. INSIDE the repeat block, add "move 100 steps" from Motion
  6. INSIDE the repeat block, below "move," add "turn right 90 degrees" from Motion
  7. Click the green flag. The cat draws a perfect square!

You only used 2 blocks inside the loop, but the cat drew all 4 sides of a square. The loop did the repeating for you!

Try It: Draw a Triangle

Can you figure out how to draw a triangle? Here are some hints:

  • A triangle has 3 sides (so repeat ___ times)
  • The turn angle for a triangle is 120 degrees (not 90!)
Answer: Use "repeat 3" with "move 100 steps" and "turn right 120 degrees" inside. The loop repeats 3 times, drawing 3 sides with 120-degree turns, making a perfect triangle!

Changing Colors

You can make your patterns more colorful by changing the pen color inside a loop. Each time the loop repeats, the color changes a little bit!

Step-by-Step: Colorful Square Spiral

  1. Start with "when green flag clicked"
  2. Add "erase all" from Pen
  3. Add "pen down" from Pen
  4. Add "set pen size to 3" from Pen (makes the line thicker and easier to see)
  5. Add "repeat 36" from Control
  6. Inside the repeat: "move 100 steps"
  7. Inside the repeat: "turn right 100 degrees" (not 90 -- try 100 for a cool effect!)
  8. Inside the repeat: "change pen color by 10" from Pen
  9. Click the green flag and watch the magic!

The sprite draws lines, turning slightly more than a right angle each time, and the color changes with each line. After 36 repeats, you get a beautiful star-like pattern in rainbow colors!

Try It: Experiment with Numbers

Change the numbers and see what happens:

  • Change "move 100 steps" to "move 50 steps" -- what changes?
  • Change "turn right 100 degrees" to "turn right 144 degrees" -- what shape do you get?
  • Change "repeat 36" to "repeat 100" -- what happens?
  • Change "change pen color by 10" to "change pen color by 1" -- how does the color change?

There are no wrong answers here! Experimenting is how real programmers discover new things.

Using the Stamp Tool

Another way to make visual patterns is the stamp block. Instead of drawing a line, "stamp" leaves a copy of the sprite wherever it is on the stage. You can use this to create rows, grids, or repeating designs.

Step-by-Step: Stamp a Row of Cats

  1. Start with "when green flag clicked"
  2. Add "erase all" from Pen
  3. Add "go to x: -200 y: 0" from Motion (moves the cat to the left side)
  4. Add "repeat 5" from Control
  5. Inside the repeat: "stamp" from Pen
  6. Inside the repeat: "move 80 steps" from Motion
  7. Click the green flag. You get a row of 5 cats across the stage!

Try It: Stamp with Size Changes

Make a growing pattern of cats! Add "change size by 20" (from Looks) inside the repeat block, after the stamp and move blocks. Each stamped cat will be bigger than the last one!

Bonus: Add "change color effect by 25" (from Looks) to make each cat a different color too. Now you have two things changing at once -- just like the double-change patterns from Lesson 2!

Geometric Art Challenge

Step-by-Step: Draw a Circle Pattern

Believe it or not, you can draw a circle using a repeat block!

  1. Start with "when green flag clicked"
  2. Add "erase all" and "pen down" from Pen
  3. Add "repeat 360" from Control
  4. Inside the repeat: "move 1 steps" from Motion
  5. Inside the repeat: "turn right 1 degrees" from Motion
  6. Click the green flag. The cat draws a circle!

How does this work? The cat takes a tiny step forward and turns a tiny bit, 360 times. After 360 tiny turns of 1 degree each, it has turned all the way around (360 degrees = full circle). It is the same idea as walking in a very large circle yourself -- lots of tiny steps with slight turns.

Try It: Create Your Own Geometric Art

Combine what you have learned to make something unique! Here are some ideas:

  • Flower: Draw a circle, turn 36 degrees, draw another circle, repeat 10 times
  • Spiral: Use a repeat block where the number of steps increases each time (use "change" blocks)
  • Mandala: Draw a shape, turn a small amount, draw it again, with color changes

Try different numbers for steps, angles, and repeats. Some of the most beautiful patterns come from unexpected number combinations!

What You Just Did

Think about everything that came together in this lesson:

  • You spotted the pattern in a square (move + turn, repeated 4 times)
  • You used a loop (repeat block) to avoid writing the same blocks over and over
  • You changed colors inside the loop to create variety
  • You used stamp to create repeating visual patterns
  • You experimented with different numbers to discover new shapes

These are real programming skills! Professional programmers use loops, pattern recognition, and experimentation every single day.

Check Your Understanding

1. What does the "repeat" block do in Scratch?

Answer: The repeat block runs the blocks inside it a set number of times. It is a loop -- it saves you from having to drag the same blocks over and over.

2. To draw a square, you use "repeat 4" with what two blocks inside?

Answer: "move ___ steps" and "turn right 90 degrees." The pattern is: move forward then turn 90 degrees, repeated 4 times.

3. What is the difference between "pen down" and "pen up"?

Answer: "Pen down" means the sprite draws a line wherever it moves (like putting a marker on paper). "Pen up" means the sprite moves without drawing (like lifting the marker off the paper).

4. What does the "stamp" block do?

Answer: The stamp block leaves a copy (image) of the sprite on the stage wherever it currently is. You can use it inside a loop to create rows or grids of images.

Key Takeaways

You Did It!

You have finished all four lessons in Module 2! You can now spot patterns everywhere and use loops in Scratch to create amazing art. Time to practice and take the quiz.

Practice Activities

Try 6 activities mixing pattern challenges with Scratch projects.

Practice Activities

Module Quiz

Test what you have learned with 8 fun questions!

Take the Quiz

Module Home

Go back to see everything in Module 2.

Module 2 Home