Next: Blocks, Previous: if Statement, Up: Statements [Contents][Index]
else statement computes an expression to decide
which of two nested statements to execute.
It looks like this:
if (condition) if-true-substatement else if-false-substatement
The first thing this does is compute the value of condition. If that is true (nonzero), then it executes the statement if-true-substatement. If the value of condition is false (zero), then it executes the statement if-false-substatement instead.
This is a complex statement because it contains components if-true-substatement and if-else-substatement that are nested statements. Each must be one and only one statement. The way to put multiple statements in such a component is to group them into a block (see Blocks).