Students use if … else to choose between two things, and see that exactly one part runs each time: the else runs only when the question is false.
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict and Run 8 min · Investigate 10 min · Modify 8 min · Mix it up 3 min · Make 8 min · Desk lamp 3 min
Click the + at the bottom of an if block to add else (otherwise). If the question is true, the first part runs; if false, the else part runs. Exactly one of the two runs each time, so if … else has no gap (like two ifs that miss a value) and no overlap. else if (more questions in a row) is the next lesson.
On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
Two signs on two doors: 'true' and 'else'. The teacher reads a question about each student in turn; they walk through exactly one door.
Nobody can go through both doors, and nobody stays behind.
Show your bike light to the next pair. Drag the light slider through 50.
Believing both parts run. Ask them to say the block aloud with 'otherwise' in place of else.
| What you will see | A question to ask | The fix |
|---|---|---|
| There is no else in the if block. | Where is the + on the if block? | Click the + at the bottom of the if. It adds an else part. |
| The lights stay on in the day. | Which part clears the screen, and when does it run? | Put clear screen (or the small square) in the else part. |
| Two ifs and an else, and the picture flickers. | How many questions do you need for two choices? | One question and an else. Delete the second if. |
One possible solution for each task. Other correct programs are fine.

basic.forever(function () {
if (input.lightLevel() < 50) {
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`)
} else {
basic.clearScreen()
}
})

basic.forever(function () {
if (input.lightLevel() < 50) {
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`)
} else {
basic.showIcon(IconNames.SmallSquare)
}
})

basic.forever(function () {
if (input.lightLevel() < 50) {
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`)
} else {
basic.showIcon(IconNames.SmallSquare)
}
})
Open task: any program that does what the step asks.
Stretch: Make the bike light flash in the dark (show, pause, clear, pause) and glow steadily in the day.
Support: Give students the if … else already in forever with the question filled in, and ask them only to fill each part.
In an if … else, when does the else part run?
Only when the question is false. Exactly one of the two parts runs each time.
Next lesson: else if, for three or more choices, where the order of the questions matters.