Story time 📖
Tap play and I''ll read this lesson to you like a story.
🤔 you are in the . You and : IF it is , THEN I will a . I will a . You just made a ! do the thing their . This is called — the a and which to . you will how that !
🧠 Key : a a ( that is or ) and then one of two . The if/ is the most way to in like .
Every if/ has . , the — a with a yes or no , like 'Is the than 10?' , the IF — the that run when the is yes (). , the — the that run when the is no (). Only ONE each the that .
| Part | What it does | Everyday example |
|---|---|---|
| Condition | Asks a true-or-false question | Is it raining? |
| IF path | Runs when the condition is TRUE | Wear a coat ☔ |
| ELSE path | Runs when the condition is FALSE | Wear a t-shirt 👕 |
🔗 Match each if/else part to the correct description.
Condition
IF path
ELSE path
Selection
a by to what it will do. of as the — you each in . When you an if/, you the . Is it or NOW? the , then on after the . you and your before you run it. 🕵️
💡 tip: Use a to at each as you it . When you the , say 'This is or 'This is and only that . the other with your so you are not by it!
🧩 A game program checks if a player has collected 5 stars ⭐. Put these steps in the correct order to trace through the program.
- Skip the ELSE path and continue the program
- Play a winning sound 🎉
- The condition is TRUE, so follow the IF path
- Check the condition: has the player collected 5 stars?
- Start the program
have — that make the in the way. A bug is the . For , IF is than 10 when you than 10. Another bug is the in the IF and — the thing at the ! and these using .
⚠️ out for this bug: to an . If there is no , the does when the is . That be , but in a it could a a when they . ask: what should in BOTH ?
🗂️ Is each situation a bug or correct code? Sort them into the right category.
The IF path plays a sad sound when the player WINS
The condition asks 'Is lives equal to 0?' but the ELSE path (not the IF path) shows Game Over
IF score is greater than 10, show 'Well done!', ELSE show 'Keep trying!'
The program checks a condition but has no ELSE path when one is needed
IF it is raining, wear a coat. ELSE wear a t-shirt.
✍️ Complete these sentences about selection. Choose the correct words from the word bank.
a a and then one of two . The when the is , and the when the is .
🌍 : Every a you have , or a when to , or a when it your — is the . If/ are used in every !
Quiz time! 📝
Branching and Decision-Making: Check Your Understanding
Question 1 of 5Tip: log in to save your score and track progress.
Finished?
Log in to mark this lesson complete and track your progress.