Remember: An if-else asks one question and then does exactly one of two paths: then when the answer is yes, else when it is no.
Read and answer
Read the story, then answer.
Bo at the bridgeKai was thirsty up in his treehouse, so Bo carried a jug of lemonade along the garden path. Kai's rule on a card said: if the bridge is clear, cross it. But a branch lay across the bridge, so the if was false and the rule said nothing at all. Bo stood at the edge and waited. Kai laughed, because Bo had done just what the rule said. An if on its own is not enough, said Kai. We need an else. The new rule said: if the bridge is clear, cross it, else hop over the stones. Now exactly one of the two paths would happen. The next day the bridge was clear, so Bo crossed it and skipped the stones.
1
Why did Bo stand still at the stream?
🌉The bridge was blocked and his rule had no else😴He was tired🫗The jug was empty
2
An if-else can run both of its paths at the same time.
TrueFalse
3
When the answer to the question is no, the part runs.
thenelseboth
4
Today the bridge is not clear. Which line of the program does Bo skip?
cross the bridgehop over the stonesneither line
5
After the two paths, the program carries on from where they meet.
TrueFalse
6
Which rule has an else, so it always does one of two things?
if it rains, take an umbrellaif it is sunny, walk to school, else take an umbrellaif the bell rings, open the door
Rules, order and fix
7
Join each part of the rule to Bo's story.
1the question
2the then part
3the else part
Ais the bridge clear?
Bhop over the stones
Ccross the bridge
8
The bridge is not clear today. Put what Bo does in order.
Bo hops over the stones
Bo asks: is the bridge clear?
Bo skips the bridge path
The answer is no
9
Look at the table. On how many of these days does Bo hop over the stones?
421
10
Bo hops over the stones even when the bridge is clear. What is the mix-up to fix?
Put the stones line under an else, so only one path runsTake out the bridge lineAdd a second bridge line
11
Bo meets two forks in a row, and each one is an if-else. How many paths does he take in all?
412
12
Write an if-else rule for your morning, with a question, a then part and an else part.
Scan the code at the top to mark this sheet on screenTake a photo of your answers or type them. It is marked for you automatically, and your score is kept.