Conditionally executes a group of statements, depending on the value of an expression.
|
---|
If condition Then statements [Else elsestatements ]
' Or, you can use the block form syntax:
Ifcondition Then
[statements]
[ElseIfcondition-nThen
[elseifstatements]] . . .
[Else
[elsestatements]]
End If |
Arguments
- condition
One or more of the following two types of expressions:
A numeric or string expression that evaluates to True or False. If condition is Null, condition is treated as False.
An expression of the form TypeOf objectname Is objecttype. The objectname is any object reference and objecttype is any valid object type. The expression is True if objectname is of the object type specified by objecttype; otherwise it is 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.
Remarks
Requirements