# Keyword Reference

If...ElseIf...Else...EndIf

Conditionally run statements.

If <expression> Then
statements
...
[ElseIf expression-n Then
[elseif statements ... ]]
...
[Else
[else statements]
...
EndIf

Parameters

expression | If the expression is true, the first statement block is executed. If not, the first true ElseIf block is executed. Otherwise, the "Else" block is executed.

Remarks

If statements may be nested.
The expression can contain the boolean operators of AND, OR, and NOT as well as the logical operators <, <=, >, >=, =, ==, and <> grouped with parentheses as needed.

Related

If...Then, Select...Case...EndSelect

Example

If $var > 0 Then
MsgBox(4096,"", "Value is positive.")
ElseIf $var < 0 Then
MsgBox(4096,"", "Value is negative.")
Else
If StringIsXDigit ($var) Then
MsgBox(4096,"", "Value might be hexadecimal!")
Else
MsgBox(4096,"", "Value is either a string or is zero.")
EndIf
EndIf