Preview
IB DP Computer Science — B2 Programming — Programming constructs | SL | B2.3.2
📋 What You Will Learn
- Describe one-way ( if ), two-way ( if/else ) and multi-way ( else if / elif ) selection
- Use relational operators (<, <=, >, >=, ==, !=) to build conditions
- Combine conditions with the Boolean operators AND, OR and NOT to control program flow
- Construct selection structures in pseudocode, Java and Python
- Trace a chain of conditions and explain why the order of the checks matters
🚦 Why This Matters A satnav at a junction asks one question — "is this the exit?" — and takes exactly one road based on the answer. Selection is how a program stops being a fixed script and starts responding to its data: one question, one chosen path, then back to the main route.
The Three Forms of Selection
- One-way ( if ): run a block only when a condition is true; otherwise skip it.
•