Computing · Year 3

Repeat and Improve: Loops in Programs

💻 ComputingMedium14 min
0
0 of 5

🎵 . You the ! Your the and it. do the thing with called a . A is an that a to do the again and again you having to them out every . you will why are one of a !

🔁 : , a that a would need 8 . With a , it needs just 3. That is than the and it is much to fix if !

of a like a . A car around the a set of before . In a , a the way: you HOW MANY the run, then the them that many and . The of is called the . the how many the .

Everyday life 🌍Programming loop 💻
Brushing teeth — 2 minutes of the same motionRepeat 120 times: move brush back and forth
Clapping a rhythm 4 timesRepeat 4 times: play clap sound
Walking 10 stepsRepeat 10 times: move forward 1 step
Printing the same stamp on a cardRepeat 6 times: stamp shape on screen
Everyday repetition vs programming loops

In a like , a like a that around the you want to . You the into a on the . The the C are called the . Every the one it is called an say it: . Each does the as the one before.

🔗 Match each programming word to its meaning. Drag the definitions to the correct words! 🧩

  • Loop

  • Loop count

  • Loop body

  • Iteration

Let us about a . A has 4 and 4 . a you would : 100 , 90 and that (8 ). With a you : 4 100 , 90 . That is only 3 ! If you to a (6 ) , you only the to 6 and the to 60 . make your and .

🧩 A sprite wants to draw a square using a loop. Put these program blocks in the correct order from top to bottom! ⬇️

  1. End of loop (close loop)
  2. Turn 90 degrees
  3. Move 100 steps
  4. Repeat 4 times (open loop)
  5. Start: when green flag clicked

🐛 tip: If your the , TWO things . 1. Is the for your ? A needs 3, a needs 5. 2. Does your add up to 360 ? For a : 4 x 90 = 360. If not, your will !

and in a . The from a got an and it to ! 🦋 When you a , try being the : through each with your , the . what the should be, then it to what on . The between your and the is your !

🗂️ Look at these program actions. Sort them into INSIDE the loop (they repeat) or OUTSIDE the loop (they only happen once). 🗂️

  • Move forward 50 steps

  • Turn right 90 degrees

  • Play a footstep sound

  • When green flag clicked

  • Set sprite colour to blue

  • Go to position x:0 y:0

⚠️ out for the ! A and on its own. This can your or make it to . ask: does my need to run a set of , or ? Most and need a with a , not a .

their by : Does it ? Does the do the ? Does it at the ? If you yes to all , your is . are not just a . They make your to , to fix, and to . You are like a ! 🌟

Quiz time! 📝

Loops Quiz — Test your knowledge! 🔁

Question 1 of 5

Tip: log in to save your score and track progress.

What is a in a ?

Finished?

Log in to mark this lesson complete and track your progress.