Computing · Stage 4

If–Then Choices

Coding & Systems · selection · write a program that chooses with IF–THEN

✦ Computing📘 Stage 4 · S4⏱ ~12 min🧒 Ages 8–9★ Free to start
I can write a program that chooses with IF–THEN.
Kavi the owl for Computing
📖

Kavi Teaches the Robot to Choose

Kavi was making a little game. "I want my robot to choose for itself," said Kavi. So Kavi wrote a special line: IF the coin is touched, THEN add 1 to the score, ELSE do nothing. Now the robot checks one thing — is the coin touched? If the answer is yes, it takes the THEN road and scores. If no, it takes the ELSE road and waits. "A program that can pick between two roads is using selection," Kavi hooted. "That is how programs make choices!"

🎓

What your child will learn

1The parts of an IF–THEN lineSelection lets a program choose. It checks one condition — a yes-or-no question. If the answer is yes, it does the THEN part; if no, it does the ELSE part. Tap each part to hear its job.
2The THEN road and the ELSE roadAn IF–THEN line makes a fork with two roads. The program checks the condition, then takes only ONE road — never both. The answer to the question decides the road.
3A program that choosesThis little program checks one thing before it acts. Press ▶ Run and watch Kavi check the condition, then take just one road.
4Read the rule, pick the roadRead the IF–THEN line, check if the condition is true, then say which road the program takes. Reveal to check.
🔍

A peek inside

Rule: IF it is raining THEN take an umbrella, ELSE wear a hat. It is NOT raining. What does Kavi do?
the condition 'it is raining' is FALSE, so take the ELSE road

Try this at home: When a program picks between two roads, that is called ____.

Ready to play and learn?

Start the free interactive lesson, or print the handout for screen-free play.

Part of Computing · Stage 4 · S4 on KAVI Academy — a secular, whole-child learning platform for ages 5–12.