Computer Science
Grade 3
20 min
Loop Practice Projects
Loop Practice Projects
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Identify a repeating pattern in a set of instructions.
Use a 'repeat' loop block to run the same commands multiple times.
Change the number in a loop to control how many times an action happens.
Build a simple project to draw a shape using a loop.
Create a simple animation sequence using a loop.
Explain why loops are useful for making code shorter.
How could you make a character dance 10 times without using the 'dance' block 10 times? Let's find a shortcut! 🕺
Today, we will practice using loops, which are a super tool for telling the computer to do something over and over again. We will build fun projects like drawing shapes and making characters move. Using loops makes our code shorter and more powerful!
Real-World Application...
2
Key Concepts & Vocabulary
TermDefinitionExample
Loop (or Repeat Block)A special instruction that tells the computer to do the same set of actions over and over again a certain number of times.A 'repeat 4 times' block is a loop that will do whatever is inside it exactly four times.
RepetitionWhen something happens again and again in the same way.Brushing your teeth is a repetition of up-and-down motions. In code, moving forward and turning right is a repetition you can loop to make a square.
Command (or Block)A single instruction that tells the computer or a character what to do.'Move forward 10 steps' is a command. 'Turn right 90 degrees' is another command.
SequenceA set of commands that are followed in a specific order, one after another.The sequence to draw one side of a square is:...
3
Core Syntax & Patterns
The Repeat Block Pattern
repeat [number] { [commands] }
Use this pattern when you want to do the exact same thing more than once. Put the number of times you want to repeat in the [number] spot and the commands you want to repeat inside the curly braces { }.
Finding the Pattern Rule
Look for a sequence of commands that happens again and again.
Before you can use a loop, you have to find the repeating part. Write out the long way first, then circle the part that is the same each time. That's what goes inside your loop!
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
You want to create a project that draws a staircase with 5 steps. Each step is made by moving right and then moving up. How would you best design the loop for this?
A.loop that repeats 5 times, containing 'move right' and 'move up' blocks.
B.loop that repeats 2 times, containing 5 'move right' and 5 'move up' blocks.
C.Two separate loops: one for moving right 5 times and one for moving up 5 times.
D.loop that repeats 10 times, containing one 'move' block.
Challenging
A project uses nested loops to draw a 5x5 grid of dots (5 rows of 5 dots). You want to change it to a 5x8 grid (5 rows of 8 dots). What do you need to change?
A.Change the outer loop to repeat 8 times.
B.Change the inner loop to repeat 8 times.
C.Change both the inner and outer loops to repeat 8 times.
D.Add a third loop that repeats 3 times.
Challenging
A project has a 'forever' loop that makes a fish swim left and right. You want to add a feature where clicking the fish makes it say 'blub'. Where should the 'When this character clicked' event block go?
A.Inside the 'forever' loop.
B.Before the 'forever' loop.
C.After the 'forever' loop.
D.Completely separate from the 'forever' loop.
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free