22 min read
Nested Decisions
Put a decision inside another decision to choose between three or more options — the cinema ticket example.
More Than Two Choices
A decision only has two exits. When there are three or more possible outcomes, put a second decision on one of the exits. This is called a nested decision (a decision inside a decision).
Nested decisions: cinema ticket price
Read this flowchart as text
- Terminator: Start (then → INPUT age)
- Input/output: INPUT age (then → age < 12?)
- Decision: age < 12? (Yes → price = 600; No → age >= 60?)
- Process: price = 600 (then → OUTPUT price)
- Decision: age >= 60? (Yes → price = 800; No → price = 1200)
- Process: price = 800 (then → OUTPUT price)
- Process: price = 1200 (then → OUTPUT price)
- Input/output: OUTPUT price (then → Stop)
- Terminator: Stop
Following Each Path
| Testing every path | |||
|---|---|---|---|
Adding a Second Rule
Order of Decisions Matters
Practice
A grading flowchart outputs A, B, C or F. How many decision symbols does it need at least?
More lessons in Algorithms, Flowcharts and Pseudocode · Next: Loops in Flowcharts · Previous: Selection Flowcharts
