Next: , Up: Conditionals   [Contents][Index]


18.9.1 if-else

The if-else statement has the form

if (exp) if_stmt [else else_stmt]

where exp is an expression that should evaluate to a boolean value (i.e. to an integer), if_stmt is a statement that will be executed if exp holds true, and else_stmt is a statement that will be executed if exp holds false. The else part of the statement is optional.