The format of a simple if statement looks like the following: | |
| |
If the 'expression' in parentheses evaluates to true, the statement is executed; otherwise, the statement is skipped. | |
If two or more lines of code are to be executed, curly braces {} must be used to designate what code belongs in the if statement. | |
The keyword else extends the functionality of the basic if statement by providing other alternatives. | |
The format of an if...else combination looks like the following: | |
| |
if the expression evaluates to true, statement1 is executed, otherwise, statement2 is executed. | |
|