switch statements
A switch statement executes statements where a case evaluates as true. The case can be a number, a string, or any other value. A switch statement is similar in some respects to an if, elseif, and else statement. The key difference is that in switch, more than one condition can run for the value being tested.
A switch statement uses the following generalized notation:
switch [-regex|-wildcard|-exact][-casesensitive] (<value>) {
<case> { <statements> }
<case> { <statements> }
default { <statements> }
}
The value is the “subject” of the switch statement; it is compared to each of the cases in turn.
The casesensitive parameter applies when the cases are strings. The regex and wildcard parameters are explored later in this section.
Each case is evaluated in turn and, by default, all matching cases will execute. The default case is optional and will only be executed if no other case matches, as shown here:
$value...