Java Reference
In-Depth Information
System.out.println(ÐDamage may occurÑ);
}
202
203
The ambiguous else is called a dangling else , and it is enough of a
syntactical blemish that some programming language designers developed an
improved syntax that avoids it altogether. For example, Algol 68 uses the
construction
if condition then statement else statement fi;
The else part is optional, but since the end of the if statement is clearly
marked, the grouping is unambiguous if there are two ifs and only one else .
Here are the two possible cases:
if c 1 then if c 2 then s 1 else s 2 fi fi;
if c 1 then if c 2 then s 1 fi else s 2 fi;
By the way, fi is just if backwards. Other languages use endif , which has
the same purpose but is less fun.
P RODUCTIVITY H INT 5.4: Make a Schedule and Make
Time for Unexpected
Problems
Commercial software is notorious for being delivered later than promised. For
example, Microsoft originally promised that the successor to its Windows XP
operating system would be available in 2004, then early in 2005, then late in
2005. Some of the early promises might not have been realistic. It is in
Microsoft's interest to let prospective customers expect the imminent availability
of the product, so that they do not switch to a different product in the meantime.
Undeniably, though, Microsoft had not anticipated the full complexity of the
tasks it had set itself to solve.
Microsoft can delay the delivery of its product, but it is likely that you cannot.
As a student or a programmer, you are expected to manage your time wisely and
to finish your assignments on time. You can probably do simple programming
exercises the night before the due date, but an assignment that looks twice as
hard may well take four times as long, because more things can go wrong. You
should therefore make a schedule whenever you start a programming project.
Search WWH ::




Custom Search