With the following c++ example(indention was left out in purpose).
if(condA) // if #1
if(condB) // if #2
if(condC) // if #3
if(condD) // if #4
funcA();
else if(condD) // else #1 if #5
funcB();
else if(condE) // else #2 if #6
funcC();
else // else #3
funcD();
else if(condF) // else #4 if #7
funcE();
else // else #5
funcF();
What else
refers to what if
and what is the rule about this? (yes I know using { }
will solve this).
DeadMG is right. Just in case you are interested, the rule is
else
is attached to the last free (that is, unprotected by braces and without corresponding else)if
.