GoalFind the steps that are repeated in an everyday task and write them once, with a “repeat” instruction.
New words
repeat · to do the same thing againrepetitive · doing the same thing again and againuntil · up to the time when something happens
Explanation
Many tasks have steps that happen again and again. Think about watering plants. We pour water on one plant, then move to the next one, and we do this for every plant. We do not need to write the same two steps ten times. We can write them once and say “Repeat steps 2 and 3 until every plant has water”. Programs do this too. Instead of copying blocks, we can use a block that repeats them. A task that repeats steps is called repetitive.
Step
Instruction
1
Fill the can with water
2
Pour water on one plant
3
Move to the next plant
4
Repeat steps 2 and 3 until all plants are watered
Worked examples
Step
Instruction
1
Wash the potatoes
2
Peel one potato
3
Put it in the pot
4
Repeat steps 2 and 3 until all the potatoes are peeled
5
Give the pot to an adult to cook
When peeling potatoes, we peel one potato and put it in the pot, and we do this for every potato. The repeated steps are step 2, peel a potato, and step 3, put it in the pot.
In Scratch, the repeat block does the job. This program repeats “move 50 steps” and “turn ↻ 90 degrees” four times. The sprite starts facing right. It draws a square path and ends where it started, facing right again.
The same idea works for a song. A chorus is sung many times, but the singer writes it down once and says “repeat the chorus”.
Class activity
Find the loop (with an adult): choose a daily task that has repeated steps, such as sweeping, setting the table, peeling vegetables or stacking books. Write the steps in order. Put a star next to the steps that repeat. Rewrite the algorithm in a shorter way with “Repeat steps … until …”. Then do the task by following your algorithm.
Practice
1
Complete: 1 Pick up the broom. 2 Sweep one patch of floor. 3 Move to the next patch. 4 Repeat steps __ and __ until the room is clean.
Repeat steps 2 and 3.
2
A child stacks 5 bricks. The long algorithm picks up a brick and puts it on the tower, five times, which is 10 steps. Write it with a repeat.
Step
Instruction
1
Pick up a brick
2
Put the brick on the tower
3
Pick up a brick
4
Put the brick on the tower
5
Pick up a brick
6
Put the brick on the tower
7
Pick up a brick
8
Put the brick on the tower
9
Pick up a brick
10
Put the brick on the tower
Repeat 5 times: pick up a brick, put the brick on the tower. (2 steps repeated 5 times.)
3
A sprite faces right. After the repeat block, where is it and which way does it face?
It makes a triangle. 3 × 120 = 360 degrees, so it is back at its start, facing right again.
4
Name an everyday task with repeated steps and say which steps repeat.
For example: eating soup. The repeated steps are: dip the spoon, lift it to your mouth.