Understanding Loops – Spot the difference.

This Scratch project below has 3 animals which have been programmed so that, when you click on them, they run one of the sets of code blocks. They show examples of count-controlled, condition-controlled and infinite loops.

But which is which?


Activity

Click on each animal. What does it do?

Can you spot whch code relates to which animal?

A.
B.
C.


Teacher Notes

The aim of this exercise is to understand that there are a range of ways that loops (iteration) work in programming. The easiest loops to understand are those that continue forever (infinite loops) or those that run for a a set number of times (count controlled loops). The final type are condition controlled loops, which run as long as a rule (or rules) is met.

This activity can be run on the board as a discussion starter, or you can use the accompanying printout to encourage students to explain their understanding. A link to the project code is available at the bottom of the download.