condition | Number or text string that evaluates to true or false. If condition is Null, then condition is treated as false. |
---|---|
statements | One or more statements separated by colons; executed if condition is true. |
condition-n | Same as condition |
elseifstatements | One or more statements executed if the associated condition-n is true. |
elsestatements | One or more statements executed if no previous condition or condition-n expression is true |
Tip: The single-row form allows to enter multiple statements, but each of the statements must be separated by "colon" character:
If A > 10 Then A = A + 1 : B = B + A : C = C + B
The Else and ElseIf clauses are both optional. You can have as many ElseIf statements as you want in a block If, but none can appear after the Else clause. Block If statements can be nested; i.e. contained within one another.
A block If statement must be the first statement on a line. The block If must end with an End If statement.
Dim Temperature
'.....
If Temperature > 95 Then
'...
ElseIf Temperature < 12 Then
'...
Else
'...
End If