Code Crew G3 / Week 02 / Wednesday
3/6
Week 02 Β· Loops

Wednesday

// Doing it again

REPEAT UNTIL

Some loops don't know how many times. They just go UNTIL something happens. Read this:

REPEAT UNTIL the cup is full:
    pour 1 spoon of water

Circle the answer

If the cup holds 8 spoons, how many times does this loop run?

(a) 1 (b) 8 (c) Forever

My answer:
WHY THIS EXERCISEREPEAT UNTIL exits when its condition becomes true. Loops that don't have a stopping condition are bugs.

Now write a REPEAT UNTIL loop for filling a backpack with books until it is heavy.

REPEAT UNTIL ____________________________:
______________________________________

Thursday: Jump-Rope Counting

Rocket can jump 6 times before tripping. Raven can jump 9 times. If they each do REPEAT 4 TIMES of their best round, count the jumps.

Rocket's total jumps: 4 Γ— 6 = ____
Raven's total jumps: 4 Γ— 9 = ____
All jumps together: ____

Find the Loop in the Wild

Each sentence is doing a loop. Write what is repeating.

I brushed each tooth, top and bottom. Repeating: ___________
I put one shoe on, then the other. Repeating: ___________
We sang the chorus three times. Repeating: ___________
← Tuesday