Simple Switch

suggest change

A switch statement compares one test value with multiple conditions and runs the action for each match. It can run more than one action. Matching is case-insensitive unless you pass -CaseSensitive.

Given the following switch…

switch($myValue)
{
    'First Condition'    { 'First Action' }
    'Second Condition'   { 'Second Action' }
}

'First Action' will be output if $myValue is set as 'First Condition'.

'Second Action' is output if $myValue is 'Second Condition'.

Nothing is output if $myValue matches neither condition.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents