AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Repeat blocks

Week 10 · Unit 4: Be an animator · 3 lessons
1

Say it once, repeat it

Computing 2: Unit 4, pp. 54–65
GoalUse a repeat block to do the same thing again and again, and say how many times it runs.
New words
repeat · to do something againrepeat block · a block that runs the blocks inside it again and againcount · how many times
Explanation

Sometimes a character must do the same thing again and again. We could use the same block many times. There is a shorter way. We put the block inside a repeat block. The number on the repeat block says how many times the blocks inside it run. In the picture, four quarter turns make one whole spin both ways. Repeat blocks make programs shorter and easier to read.

Long3333Short34
Worked examples
Long2222Short24
A rabbit moves right 2 four times. The long way uses four blocks. The short way uses one repeat block with 4. The rabbit moves 2 × 4 = 8 squares either way.
Hi!3
Repeat 3 with a say block inside makes the character say Hi! three times.
14start ontapgrowrepeatend
In words, the algorithm is: start on tap, repeat 4 times: grow by 1, stop. The character grows four times, so it gets bigger and bigger.
Class activity

Repeat dance: write a dance of three moves on paper, for example clap, stamp, spin. Now think of a move that you do many times, such as clap. Instead of writing clap five times, write “repeat 5: clap” and do it. Count out loud: one, two, three, four, five. Then change the number on the repeat to 3 and do it again. How does the number change what happens?

Practice
1
How many times does the character hop?
14
2
Write a shorter program for this one, using a repeat block.
22222
3
How many squares does the character move in all?
23
4
Why is a repeat block useful?