This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Read from JLS the following quote... -------------------------------------------------- 14.7 Statements are thus gramatically divided into 2 categories: that which might end in an if statement that has no else block(short if statement) and those that definitely do not.Only those that definitely do not end in a short if statement may appear as an immeadiate substatement before the keyword else in an if statement that does not have an else clause -------------------------------------------------
Am confused about this Can someone help please Thanks
"Only statements that definitely do not end in a short if statement may appear as an immediate substatement before the keyword else in an if statement that does have an else clause." We see in the above example a violation of the statement above. The sub-if is trying to be a short-if but it can't because the the main-if's else statement gets assigned to the short if. In other words the above code gets turned into:
The solution around this problem is the proper use of braces to identify where the if-else statements belong.
sun par
Ranch Hand
Joined: Oct 03, 2002
Posts: 257
posted
0
I am sorry.. it is under 14.5 in the chapter "Blocks and Statements" under the heading "Statements" in the last before paragraph... Thanks.