Switch statement
suggest changeIntroduction
A switch statement tests a value against a list of conditions. Each match runs its action, and more than one condition can match unless you use break. The comparison is case-insensitive by default and is not limited to equality. Wildcard, regex, and script-block conditions are covered in the following pages. This avoids a long chain of if statements.
Remarks
This topic is documenting the switch statement used for branching the flow of the script. Do not confuse it with switch parameters which are used in functions as boolean flags.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents