Loops: Telling the Computer to Do It Again
Clap your hands 5 times! Did you say 'clap, clap, clap, clap, clap'? That is a lot of words. A computer person would just say: clap 5 times. That short way of saying 'do it again' is called a LOOP. A loop lets you repeat something without writing it over and over. Computers love loops because they can do the same thing a hundred times and never get tired!
What You'll Learn
In this lesson you will: - Find out what a loop is - Turn a long list of steps into one short loop - Count how many times a loop repeats - Make your own loop with your body
What Is a Loop?
A loop is a way to say 'do this again.' Instead of writing 'jump, jump, jump,' you write 'jump 3 times.' Think about brushing your teeth. You brush, brush, brush the same way many times. Your arm is doing a loop! Anytime you repeat the same move, that is a loop.
Counting the Loop
Every loop has a number. The number tells HOW MANY times to repeat. 'Hop 4 times' means do the hop, then again, then again, then again. That is 4 hops. If the number were 2, you would hop only 2 times. The number is the boss of the loop!
When you see the word 'times' after a number, think LOOP! 'Spin 3 times' is a loop that repeats 3 times.
Loops Save Your Fingers
Imagine you want a robot to walk 10 steps. You could write 'step' ten times. That takes a long time and your hand gets tired! With a loop you just write 'step 10 times.' Short and easy. Loops help us give big jobs in tiny instructions.
Match each loop to how many times it repeats.
Terms
Definitions
Drag terms onto their definitions, or click a term then click a definition to match.
What does a loop help you do?
Which one is the SHORT way (a loop) to say 'wave, wave, wave'?
Flashcards โ click each card to reveal the answer
Make a Body Loop
Be a loop with your body! 1) Pick one move: a clap, a hop, or a spin. 2) Pick a number from 1 to 5. 3) Say your loop out loud, like 'clap 4 times,' then DO it while a grown-up counts. 4) Try a new move and a new number. Deliverable: show a grown-up two different body loops and tell them the number for each.
Want to keep learning?
Sign up for free to access the full curriculum โ all subjects, all ages.
Start Learning Free