Changes

Jump to: navigation, search

The Windows PowerShell 1.0 switch Statement

21 bytes added, 18:56, 3 December 2008
no edit summary
For each possible match a ''<pattern>'' is required. This can either be a single value against which the comparison is made, a wildard, regular expression or any other expression. Following on from the case lines are the Windows PowerShell statements which are to be executed in the event of the pattern match or expression evaluating to be ''true''.
After the The statement block ''statements'' comes may also contain an optional ''break'' or ''continue'' statement. These statements are used either to break out of the ''switch'' statement when a match is found, or skip any remaining code in a loop and begin the next iteration. If a ''break'' or ''continue'' is not specified, the switch statement will continue to work through any remaining cases even when a match has been found.
Finally, the ''default'' section of the construct defines what should happen if none of the case statements present a match to the ''value''.

Navigation menu