Coding with Repeats

What your child is learning
Coding in Grade 2 is mostly unplugged: no computer needed. Children write and follow clear instructions that move a character (often a classmate, a toy or a picture on a grid) from one place to another. The core of Grade 2 coding is steps that happen in order (sequential events) and steps that happen at the same time (concurrent events). Repetition, writing "repeat 4 times: forward" instead of "forward, forward, forward, forward", is introduced more formally in a later grade, but it grows so naturally out of this kind of coding that this guide uses it as a stretch.
Your child is learning to:
- Read and follow a short sequence of instructions in order.
- Write their own sequence to reach a goal.
- Stretch: spot a set of steps that repeats and replace it with a loop.
- Predict where a character will end up before running the code.
- Find and fix a "bug" when the code doesn't do what it should.
- Notice that two things can happen at the same time (concurrent events), like two characters moving together.
Coding sits in the Algebra strand because it's about precise rules and patterns.
Why it matters
Coding teaches a habit that helps in every subject: breaking a task into small, exact steps. Children discover that "go to the door" is not an instruction a robot can follow, but "forward 3, turn right, forward 2" is. That precision carries over to explaining math thinking and writing clear sentences.
Loops in particular connect to the math children are learning. Repeating "forward 2" five times is the same as moving 10 squares, which is equal groups and multiplication in action. Recognising a repeating chunk is the same skill as spotting a pattern.
How to teach it
1. Be the robot
Tell your child you're a robot who only understands three commands: "step forward", "turn left" and "turn right" (each turn is a quarter turn, like the corner of a square). They have to guide you to the fridge. Follow their instructions exactly, even when they make you walk into the couch. Kids find this hilarious, and it shows them why precise code matters.
2. Use a floor grid
Make a 5 by 5 grid with painter's tape on the floor, or draw one on paper and use a small toy. Put a "goal" (a sock, a toy) in one square. Make cards for the three commands: forward, turn left and turn right. Your child lays out the cards in order, then runs the program by moving the toy.
Worked example: The toy needs to move forward 4 squares, turn right, then forward 4 squares.
Long version: forward, forward, forward, forward, turn right, forward, forward, forward, forward. (9 cards)
With loops: repeat 4 [forward], turn right, repeat 4 [forward]. (3 cards instead of 9)
Ask your child to run both versions and check that the toy ends on the same square.
3. Look for repeats
Show a long instruction list and ask your child to circle anything that repeats. A square path, for example, is "forward 3, turn right" four times. They can write it as a loop: repeat 4 [forward 3, turn right].
| Long code | With a loop |
|---|---|
| clap, clap, clap, clap, clap | repeat 5 [clap] |
| hop, spin, hop, spin, hop, spin | repeat 3 [hop, spin] |
| forward 2, turn left, forward 2, turn left | repeat 2 [forward 2, turn left] |
4. Debug on purpose
Write code that almost works, with one wrong step. Let your child run it, see where it goes wrong, and fix only the broken step. Debugging is a skill that deserves praise in its own right.
5. Two at once
Have two toys follow two short programs at the same time, one step each per "tick". Will they bump into each other? That's concurrent events, and it's a fun puzzle to predict.
Common mistakes
- Mixing up left and right after turning. When the toy faces the child, its right is their left. Have them stand behind the toy or turn their own body to match.
- Forgetting that turning doesn't move you. Counting a turn as a step forward. Act it out: turning on the spot keeps you in the same square.
- Putting the wrong steps inside the loop. Repeating "forward, turn" when only "forward" should repeat. Run the code slowly and see what happens.
- Starting over when there's a bug. Encourage fixing just the step that went wrong instead of rewriting everything.
Do this together
Pencil robot. On grid paper, your child is the robot and the pencil is its pen. The code is "forward 3" (draw a line 3 squares long) and "turn right" or "turn left". Write a short program, such as repeat 4 [forward 3, turn right], and have your child run it to see what picture appears. Then swap: they write a program, you draw it. Try changing one number and predict how the picture will change. If a drawing comes out wrong, hunt for the bug together.
Printable worksheet
17 questions, a picture warm-up and drawing tasks, with an answer key on its own page. Print it or save it as a PDF.
Every worksheet is on the printable worksheets page.
Ontario curriculum: Grade 2, Algebra, expectation C3 · official document · U.S. Common Core crosswalk