next up previous contents
Next: 6.3 While Up: 6 Control Flow Previous: 6.1 Statements and Blocks

6.2 If-Else

The if else statement is used to make decisions. The syntax is:

if ( expression )

expression is evaluated; if it is not equal to zero (e.g., logic true), then statement-1 is executed.

The else clause is optional. If the if part of the statement did not execute, and the else is present, then statement-2 executes.

Fred G. Martin
Fri Mar 29 17:44:15 EST 1996