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
2

Repeat with more blocks

Computing 2: Unit 4, pp. 54–65
GoalTrace a repeat block that holds more than one block.
New words
inside · the blocks that sit within the repeat blockround · one run of all the blocks inside a repeat blocktrace · to follow a program step by step
Explanation

A repeat block can hold more than one block. All the blocks inside run once. That is one round. Then they run again until the number is used up. Repeat 3 with right 2 and spin right 12 inside runs: right 2, spin, right 2, spin, right 2, spin. Blocks outside the repeat run only once. Trace each round to find the result.

2123Done!
Worked examples
After roundAcrossSpins
start00
121
242
363
Trace the program above. After each round the character has moved 2 more squares across and has spun once. After 3 rounds it is 6 across and has spun 3 times. Then it says Done! once.
Hi!112
Blocks outside a repeat run only once. This character says Hi! one time, then goes up 1 and down 1 twice.
Long313131Short313
We can turn a long program into a short one. The long program does right 3 and up 1 three times. The short one puts right 3 and up 1 in a repeat block with 3.
Class activity

Human repeat: make three cards: take 2 steps forward, clap once, a repeat card with the number 3. Put the two action cards inside the repeat card. Run the program with your body and count your steps and claps. You should take 6 steps and clap 3 times. Then change the repeat number to 4. How many steps and claps now? Check your answers by doing it.

Practice
1
The character starts at 0 across and 0 up. Where does it finish?
312
2
How many times does the say block run, and how many times does the hop block run?
Go!13
3
Write the short version: right 1, up 2, right 1, up 2, right 1, up 2, right 1, up 2.
12121212
4
A repeat block has the number 5 and a right 2 block inside. How far does the character move?