Visual Basic : If Test Then Else Statement Blog :
Visual Basic :
condition
Required. Expression. Must evaluate to True or False, or to a data type that is implicitly convertible to Boolean.
If the expression is a Nullable Boolean variable that evaluates to Nothing, the condition is treated as if the expression is not True, and the Else block is executed.
Then Required in the single-line syntax; optional in the multiple-line syntax. statements Optional. One or more statements following If...Then that are executed if condition evaluates to True. else if condition Required if Else If is present. Expression. Must evaluate to True or False, or to a data type that is implicitly convertible to Boolean. else if statements Optional.
One or more statements following Else If...Then
that are executed if else if condition evaluates to True.
Else statements Optional. One or more statements that are executed if no previous condition or else if condition expression evaluates to True.
End If Terminates the If...Then...Else block
Press Icon for Example