The <code>else</code> in <code>if (a) if (b) S1 else S2</code> binds to
- A
if (a)
- Bcheck_circle
if (b) — the nearest unmatched if
- C
Both
- D
Neither
Explanation
"Dangling else" rule: matches the nearest preceding <code>if</code>.
AP Computer Science A· difficulty 4/5
The <code>else</code> in <code>if (a) if (b) S1 else S2</code> binds to
if (a)
if (b) — the nearest unmatched if
Both
Neither
Explanation
"Dangling else" rule: matches the nearest preceding <code>if</code>.
Want 10 more like this — adaptive to your weak spots?