# Keyword Reference

# Select...Case...EndSelect

Conditionally run statements.

Select
Case <expression1>
statement1
...
[Case <expression2>
statement2
...]
[Case <expressionn>
statementn
...]
[Case Else
statementElse
...]
EndSelect

## Parameters

<expression> | If the expression is true the following statements up to the next Case or EndSelect statement are executed. If more than one of the Case statements are true, only the first one is executed.

## Remarks

Select 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, If...Else...EndIf, Switch...EndSwitch, ContinueCase

## Example

    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        Local $iValue = 0
        Local $sBlank = "Test"

        Select
            Case $iValue = 1
                MsgBox($MB_SYSTEMMODAL, "", "The first expression was True.")
            Case $sBlank = "Test"
                MsgBox($MB_SYSTEMMODAL, "", "The second expression was True")
            Case Else ; If nothing matches then execute the following.
                MsgBox($MB_SYSTEMMODAL, "", "No preceding case was True.")
        EndSelect
    EndFunc   ;==>Example