if (comparison expression) statement; else statement;
Single Statement Example:
if (X<=10) X++; else X=0;
(If
X is less than or equal to 10 then add 1 to the value of X, otherwise
set X to 0)
Multi Statement Example:
If (X<=10) {
X++;
printf ("%s \n", "X is
less than 10");
} else {
X=0;
cout << "Finished" <<
endl;
}
(If
X is less than or equal to 10 then add 1 to the value of X, and print
the statement "X is less than 10". Otherwise set X=0 and print the
statement "Finished.")