The conditional statement takes two forms:
if (expression) statement if (expression) statement else statementThe expression is evaluated; it must have type
int
. If it is non-zero, then the first statement is executed. In the second form, the second statement is executed if the expression is 0. The statement after else
is connected to the nearest else
-less if
.