Programming with loops and choices
Read together
A program is a set of instructions. Computers follow them exactly, in order. This is called sequence.
A loop repeats instructions: “repeat 4 times: step forward, turn right” draws a square.
A choice, or conditional, makes a decision: “if it is raining, take an umbrella, otherwise take a hat”.
Do it
- Play “robot”: write a program for a partner to draw a square on the floor using only the commands step forward, turn right and repeat.
- Make it shorter by using a loop. Count the instructions before and after.
- Add a choice: “if the next square is blue, turn left, otherwise go forward”. Test it on a taped grid.
- If you use a computer, try a block-based programming tool offline or in a class. Make a sprite draw a square with a loop.
Talk about it
- How did the loop make your program shorter?
- What happens if you change the order of the steps?
For the grown-up
Sequence, loops and conditionals are the building blocks of nearly all programs. Learning them unplugged first gives children a clear idea before they use a screen. If your child uses an online coding tool, check its privacy settings.
Where this comes from
- Computer Science Teachers Association (CSTA), CSTA K-12 Computer Science Standards (2017), on algorithms and programming
- Code.org, CS Fundamentals curriculum, unplugged and online activities on sequences, loops and conditionals
Written with AI assistance and checked against the sources listed. Please read it before sharing it with a child.