section 3.2: If-Else

The syntax description here may seem to suggest that statement<sub>1</sub> and statement<sub>2</sub> must be single, simple statements, but, as mentioned in section 3.1, a block of statements enclosed in braces {} is equivalent to a single statement.

page 56

``Coding shortcuts'' like

can indeed be cryptic, but they're also quite common, so you'll need to be able to recognize them even if you don't choose to write them in your own code. Whenever you see code like
	if (x)
	if (f())
where x or f() do not have obvious ``Boolean'' names, just mentally add in != 0.

Don't worry too much if the multiple if/else ambiguity described on page 56 doesn't make perfect sense; just note the deep sentence:'s a good idea to use braces when there are nested ifs.

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995, 1996 // mail feedback