Work through the list without notes. If you cannot do a statement, follow its link, then come back. Guide = study guide; Practice = practice questions.
Understanding
- I can explain when the inner condition of a nested if is evaluated and when it is not. (Guide: “Nested if statements”; Practice questions 2 and 8)
- I can explain why at most one body runs in an if-else-if chain. (Guide: “Multiway selection: if-else-if”; Practice questions 1 and 5)
- I can say what happens when no condition in a chain is true, with and without a trailing else. (Guide: “Multiway selection”; Practice question 6)
- I can explain which if an else belongs to in the dangling else case. (Guide: “The dangling else”; Practice questions 3 and 10)
Skills
- I can trace a nested structure with a table showing which conditions are evaluated. (Guide: Worked example 2; Practice question 8)
- I can write an if-else-if chain for a set of bands with correct boundaries. (Guide: Worked example 1; Practice questions 4 and 7)
- I can convert between a nested if and an if-else-if chain where possible. (Guide: “Which structure should I use?”; Practice question 7)
- I can add braces to remove a dangling else. (Guide: “The dangling else”; Practice question 10)
Reasoning
- I can explain why the order of overlapping conditions changes the result. (Guide: “Order of the conditions matters”; Practice questions 4 and 9)
- I can explain why separate ifs and an else-if chain can give different results. (Guide: “Separate ifs versus an else-if chain”; Practice question 5)
- I can say why a variable assigned only in some branches may stop code compiling. (Practice question 6)
All ticked? Move on to the Topic 2.5 study guide, Compound Boolean Expressions.