Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Lesson details

      Learning outcome

      I can tell the difference between count-controlled loops and infinite loops.

      Key learning points

      1. In programming, there are count-controlled loops and infinite loops.
      2. An infinite loop is a sequence of instructions that is continuously repeated, without an end point.
      3. Different types of loops are more suitable for different tasks.

      Keywords

      • Repeat - happen multiple times

      • Count-controlled loop - a chunk of code that runs a section of the program a certain number of times

      • Infinite loop - a chunk of code that runs a section of the program continuously

      Common misconception

      A count-controlled loop repeats forever.

      An infinite loop repeats forever, unless the program is stopped.

      Teacher tip

      In this lesson, sprites change costumes. Costumes are alternative appearances of a sprite, which can be named, edited, created, and deleted. Here, they are used as part of an animation, where the sprite moves from one costume to the next.

      Equipment

      Pupils will need access to a device with block-based programming software. Examples in this lesson use Scratch https://oak.link/scratch

      Licence

      This content is © Oak National Academy Limited (2026), licensed on Open Government Licence version 3.0
      except where otherwise stated. See Oak's terms & conditions
      (Collection 2).

      Lesson video

      Loading...

      Prior knowledge starter quiz

      6 Questions

      Q1.
      Which of these is an example of repetition in everyday life?

      a rainbow after rain
      a single apple on a tree
      a birthday card for your ninth birthday
      Correct answer: the ticking of a clock

      Q2.
      What do we call a single instruction that tells a computer what to do?

      Correct Answer: command, a command

      Q3.
      Match the real-life example to the type of repetition.

      Correct Answer:days of the week,repeating cycle

      repeating cycle

      Correct Answer:tiles on a floor,repeating pattern

      repeating pattern

      Correct Answer:steps in a dance,repeated actions

      repeated actions

      Correct Answer:clapping in a song,repeated sound

      repeated sound

      Q4.
      What is something you can change in a code snippet to get a different result?

      the paper it is written on
      Correct answer: the number in a loop
      the size of your computer
      the day of the week

      Q5.
      If you want a sprite to jump three times, which loop would you use?

      Correct answer: repeat 3
      loop 3
      repeat forever
      repeat until done

      Q6.
      In programming, what is the purpose of a count-controlled loop?

      to make the code stop
      to write a story
      Correct answer: to do the same thing several times
      to change the colour of text

      6 Questions

      Q1.
      What is an infinite loop?

      Correct answer: a loop that repeats forever
      a loop that repeats twice
      a loop that never starts
      a loop that counts backwards

      Q2.
      Which block in Scratch is most likely to create an infinite loop?

      Correct Answer: forever

      Q3.
      Why might you use a count-controlled loop instead of an infinite loop?

      to repeat an action forever
      Correct answer: to repeat an action a set number of times
      to change the sprite’s colour
      to stop the program

      Q4.
      Which of these is an example of an infinite loop in real life?

      brushing your teeth once
      jumping three times
      writing your name once
      Correct answer: a clock ticking continuously

      Q5.
      What is a key difference between count-controlled and infinite loops?

      only infinite loops can move sprites
      Correct answer: count-controlled loops have an end, infinite loops do not
      both always repeat forever
      both require costumes

      Q6.
      Match the Scratch block to the type of loop it creates.

      Correct Answer:repeat 10,count-controlled loop

      count-controlled loop

      Correct Answer:forever,infinite loop

      infinite loop

      Correct Answer:wait 1 second,not a loop

      not a loop


      To help you plan your 4 computing lesson on: Types of loops, download all teaching resources for free and adapt to suit your pupils' needs...