Dangling else: An else matches the nearest unmatched if, which can cause unexpected behavior without braces.
How to apply it: Always use braces to avoid dangling else bugs on the exam.
Course: AP Computer Science A · Unit: Boolean Expressions and if Statements
Practice questions about Dangling else on AimFive — get rubric-based feedback showing exactly which points you earned.
AP and Advanced Placement are trademarks of College Board. AimFive is not affiliated with or endorsed by College Board.