← Back to course
Code Crew G2 / Week 09 / Wednesday
3/6
Week 09 · Read Ten Lines

Wednesday

Then or otherwise?
// Read a long program in chunks
⏱ about 15 min
Rocket the inventor holding his engineering tablet

Then or otherwise?

Test ships use fuel as they fly.

Rocket writes a program with a fuel box.

A loop takes fuel away, bit by bit.

Then a check looks at the fuel box.

Raven asks, which line will run?

You need to know the fuel first.

WARM-UP: LOOP ROUNDS
  • Count the loop rounds.
  • Tap the answer.
the program
?
the program
?
A ten line program in chunks: boxes, loop, check, say

A check after a loop

The loop changes two boxes.

Then the check reads the fuel box.

Work out the fuel before the check!

set fuel to 5
set height to 2
repeat 2 times:
lower fuel by 1
change height by 1
stop
if fuel under 4
then land
otherwise say safe
say height
Raven the explorer with her wrist computer

What do you notice?

After the loop, fuel holds 3.

Is 3 under 4? Yes!

So the then line runs.

WHICH LINE RUNS?
  • Work out the box first.
  • Then read the check.
the loop chunk
?
fuel holds 3
the check chunk
?
the program
?

Build a program that says safe.

Fuel starts at 6 and goes down 1.

Then the check runs.

MAKE NOVA SAY SAFE
  • Get the fuel ready first.
  • Then the three check lines.
1line 1
2line 2
3line 3
4line 4
5line 5
An empty memory box named height, waiting for a number

Raven has tricky ones

TRICKY ONES!
  • Change the box before the check.
  • Tap the line that runs.
the program
?
the program
?

Word Spot: carry, state, book

Here are new sight words.

Look at each word. Say it. Spell it.

Carry: C-A-R-R-Y.

State: S-T-A-T-E.

Book: B-O-O-K.

FIND THE WORD
  • Listen to the word.
  • Tap it.
Listen and find
?
Listen and find
?
Listen and find
?
Listen and find
?
FILL THE GAP
  • Listen to the sentence.
  • Tap the missing word.
Which word fits?
?
Which word fits?
?

Checks after loops? Done!

Work out the box first.

Then read the check.

Only one line runs: then or otherwise.

Great work, Crew!

← Tuesday