If <condition> Then <TrueStatement> else <FalseStatement>
The If statement provides for conditional processing. That is it tests for a condition to be true or false and executes a different statement (or group of statements) based on the result.
Therefore if the test is true it executes one statement (the true statement), else if the test is false it executes a different statement (the false statement). This allows you to provide alternate code to handle different situations.
The most basic form of the If statement provides only the true statement. This is sometimes referred to as an If...Then statement). In this case no false statement is provided and nothing occurs if the result is false. By reversing the test you can provide either a true of false statement and nothing for the other result.
The other form is to provide both the true and false statements. This is sometimes referred to as an If...Else statement. In this case one statement is executed if the result is true, a different statement is executed if the result is false.
An If...Else statement is considered one whole statement. Therefore no semi-colon is required at the end of the true statement (before the else). Refer to If...Else example above.
You can check for multiple conditions within an If statement. When doing so you need to enclose each condition within parenthesis. Each condition is joined together through the use of See "Boolean Operators".
You can also nest If statements to provide further conditional checks. An alternative to nested If statements is the Case statement however the Case statement can only be used with testing ordinal values (eg Numeric or Set type values).