When you write nested ifs without braces, an else always binds to the nearest unmatched if, regardless of indentation. The classic example:
if (a)
if (b)
x();
else
y();Visually the else looks like it pairs with if (a), but the compiler pairs it with if (b). So y() runs only when a is true and b is false, the opposite of what indentation suggested. The fix is to always brace single-statement bodies, which makes the binding unambiguous. Some style guides enforce this with a linter.