Curriculum

Curriculum

Spot and Remove an Unreachable Branch

Scenario

A course attendance checker starts with attendance < 75 -> Yes: Not Eligible. On the No branch, an author accidentally added a second diamond: attendance < 60 -> Yes: Warning, No: Eligible.

Selected choicePick a choice below
Result—

Try it yourself

Try to pick a number for attendance that reaches the Warning output.

Reveal the explanation
  1. attendance = 55

    Not Eligible

  2. attendance = 75

    Eligible

  3. attendance = 68

    Not Eligible

Comparing the original flowchart with the simplified two-outcome version shows identical outputs for every possible input. Removing dead branches makes flowcharts cleaner and prevents false assumptions about how Warning works.

Download shared test cases

Your turn

Inspect an event waitlist flowchart: Diamond 1 checks seatsLeft == 0 -> Yes: Waitlist. Its No arrow goes to Diamond 2: seatsLeft <= 0 -> Yes: Waitlist, No: Reserve Seat. Assuming seatsLeft >= 0, simplify the flowchart.

Common mistake Deleting Diamond 1 instead of Diamond 2, or forgetting to test seatsLeft = 0 and seatsLeft = 1 after simplifying.

Check your work

One diamond (seatsLeft == 0) with Yes -> Waitlist and No -> Reserve Seat, producing the exact same result for seatsLeft = 0, 1, and 5.

Quick check

After checking attendance < 75 and branching Yes to Not Eligible, why is a check for attendance < 60 on the No branch unreachable?
Show the answer and reasoning

Correct answer Because every value reaching the No branch is already >= 75 and can never be < 60.

Only values that fail attendance < 75 enter the No branch, meaning attendance is at least 75 and never less than 60.