Rocket hears the clock go tick, tick, tick. "That's a loop!" he says.
Raven looks around the room. "What do you notice that repeats?" she asks. "There's always another clue."
Nova scans the room. "Loops can hide in sounds and lights," she says.
Let's find three loops around us. Then we'll write one as code.
Find at least 3 loops happening AROUND you right now.
Examples: a clock ticking, your breathing, traffic lights, a fan spinning.
REPEAT _____ TIMES:
____________________________ | Statement | True or false? |
|---|---|
| REPEAT N TIMES runs a set number of times. | ? |
| REPEAT UNTIL stops when something happens. | ? |
| A loop inside a loop is called a nested loop. | ? |
| A forever loop is a good way to end a program. | ? |
| REPEAT 4 TIMES: (hop) makes 8 hops. | ? |
Week 3: CONDITIONALS. IF this happens, THEN do that.