@@ -63,10 +63,10 @@ labeled-statement:
6363
6464Description:
6565
66- An iteration statement ([§8.4][§8.4]) or a switch statement ([§8.6][§8.6]) may optionally be preceded
67- immediately by one statement label, *label*. A statement label is used as the optional target of a
68- break ([§8.5.1][§8.5.1]) or continue ([§8.5.2][§8.5.2]) statement. However, a label does not alter the flow of
69- control.
66+ An iteration statement ([§8.4][§8.4]) or a switch statement ([§8.6][§8.6]) may optionally be
67+ preceded immediately by one statement label, *label*. A statement label is used as the optional
68+ target of a break ([§8.5.1][§8.5.1]) or continue ([§8.5.2][§8.5.2]) statement. However, a label
69+ does not alter the flow of control.
7070
7171White space is not permitted between the colon (` :`) and the token that follows it.
7272
@@ -228,14 +228,14 @@ governing arguments are as follows:
228228- Putting parentheses around an argument causes that expression to be evaluated with the result
229229 being passed instead of the text of the original expression.
230230
231- - To pass an argument that looks like a switch parameter ([§2.3.4][§2.3.4]) but is not intended as such,
232- enclose that argument in quotes.
231+ - To pass an argument that looks like a switch parameter ([§2.3.4][§2.3.4]) but is not intended as
232+ such, enclose that argument in quotes.
233233
234234- When specifying an argument that matches a parameter having the `[switch]` type constraint
235- ([§8.10.5][§8.10.5]), the presence of the argument name on its own causes that parameter to be set to
236- ` $true` . However, the parameter's value can be set explicitly by appending a suffix to the
237- argument. For example, given a type constrained parameter *p*, an argument of `-p:$true` sets p to
238- True, while `-p:$false` sets p to False.
235+ ([§8.10.5][§8.10.5]), the presence of the argument name on its own causes that parameter to be
236+ set to `$true`. However, the parameter's value can be set explicitly by appending a suffix to the
237+ argument. For example, given a type constrained parameter *p*, an argument of `-p:$true` sets p
238+ to True, while `-p:$false` sets p to False.
239239
240240- An argument of `--` indicates that all arguments following it are to be passed in their actual
241241 form as though double quotes were placed around them.
@@ -258,16 +258,16 @@ For information about parameter binding see [§8.14][§8.14]. For information ab
258258[§3.8][§3.8].
259259
260260Once argument processing has been completed, the command is invoked. If the invoked command
261- terminates normally ([§8.5.4][§8.5.4]), control reverts to the point in the script or function immediately
262- following the command invocation. For a description of the behavior on abnormal termination see
263- ` break` ([§8.5.1][§8.5.1]), `continue` ([§8.5.2][§8.5.2]), `throw` ([§8.5.3][§8.5.3]), `exit` ([§8.5.5][§8.5.5]), `try `
264- ([§8.7][§8.7]), and `trap` ([§8.8][§8.8]).
261+ terminates normally ([§8.5.4][§8.5.4]), control reverts to the point in the script or function
262+ immediately following the command invocation. For a description of the behavior on abnormal
263+ termination see `break` ([§8.5.1][§8.5.1]), `continue` ([§8.5.2][§8.5.2]), `throw`
264+ ([§8.5.3][§8.5.3]), `exit` ([§8.5.5][§8.5.5]), `try` ([§8. 7][§8.7]), and `trap` ([§8.8][§8.8]).
265265
266266Ordinarily, a command is invoked by using its name followed by any arguments. However, the
267267command-invocation operator, &, can be used. If the command name contains unescaped white space, it
268- must be quoted and invoked with this operator. As a script block has no name, it too must be invoked
269- with this operator. For example, the following invocations of a command call `Get-Factorial` are
270- equivalent :
268+ must be quoted and invoked with this operator. As a script block has no name, it too must be
269+ invoked with this operator. For example, the following invocations of a command call
270+ `Get-Factorial` are equivalent :
271271
272272` ` ` powershell
273273Get-Factorial 5
@@ -292,7 +292,9 @@ New-Object -ArgumentList 3,2 -TypeName 'int[,]'
292292
293293dir e:\P owerShell\S cripts\* statement*.ps1 | Foreach-Object {$_.Length}
294294
295- dir e:\P owerShell\S cripts\* .ps1 | Select-String -List "catch" | Format-Table path,linenumber -AutoSize
295+ dir e:\P owerShell\S cripts\* .ps1 |
296+ Select-String -List "catch" |
297+ Format-Table path,linenumber -AutoSize
296298` ` `
297299
298300# # 8.3 The if statement
@@ -786,15 +788,15 @@ switch-parameters:
786788 switch-parameters switch-parameter
787789
788790switch-parameter :
789- -regex
790- -wildcard
791- -exact
792- -casesensitive
793- -parallel
791+ -Regex
792+ -Wildcard
793+ -Exact
794+ -CaseSensitive
795+ -Parallel
794796
795797switch-condition :
796798 ( new-lines~opt~ pipeline new-lines~opt~ )
797- -file new-lines~opt~ switch-filename
799+ -File new-lines~opt~ switch-filename
798800
799801switch-filename :
800802 command-argument
@@ -847,26 +849,26 @@ that *statement-block*'s *switch-clause-condition*.
847849Matching of non-strings is done by testing for equality ([§7.8.1][§7.8.1]).
848850
849851If the matching involves strings, by default, the comparison is case-insensitive. The presence of
850- the *switch-parameter* `-casesensitive ` makes the comparison case-sensitive.
852+ the *switch-parameter* `-CaseSensitive ` makes the comparison case-sensitive.
851853
852854A pattern may contain wildcard characters ([§3.15][§3.15]), in which case, wildcard string comparisons
853- are performed, but only if the *switch-parameter* -wildcard is present. By default, the comparison
855+ are performed, but only if the *switch-parameter* `-Wildcard` is present. By default, the comparison
854856is case-insensitive.
855857
856858A pattern may contain a regular expression ([§3.16][§3.16]), in which case, regular expression string
857- comparisons are performed, but only if the *switch-parameter* `-regex ` is present. By default, the
858- comparison is case-insensitive. If `-regex ` is present and a pattern is matched, `$matches` is
859+ comparisons are performed, but only if the *switch-parameter* `-Regex ` is present. By default, the
860+ comparison is case-insensitive. If `-Regex ` is present and a pattern is matched, `$matches` is
859861defined in the *switch-clause* *statement-block* for that pattern.
860862
861863A *switch-parameter* may be abbreviated; any distinct leading part of a parameter may be used. For
862- example, `‑regex `, `‑rege `, `‑reg `, `‑re `, and `‑r ` are equivalent.
864+ example, `‑Regex `, `‑Rege `, `‑Reg `, `‑Re `, and `‑R ` are equivalent.
863865
864866If conflicting *switch-parameter*s are specified, the lexically final one prevails. The presence of
865- ` ‑exact ` disables `-regex ` and `-wildcard `; it has no affect on `‑case `, however.
867+ ` ‑Exact ` disables `-Regex ` and `-Wildcard `; it has no affect on `‑Case `, however.
866868
867- If the *switch-parameter* `‑parallel ` is specified, the behavior is implementation defined.
869+ If the *switch-parameter* `‑Parallel ` is specified, the behavior is implementation defined.
868870
869- The *switch-parameter* `‑parallel ` is only allowed in a workflow ([§8.10.2][§8.10.2]).
871+ The *switch-parameter* `‑Parallel ` is only allowed in a workflow ([§8.10.2][§8.10.2]).
870872
871873If a pattern is a *script-block-expression*, that block is evaluated and the result is converted to
872874bool, if necessary. If the result has the value `$true`, the corresponding *statement-block* is
@@ -880,7 +882,7 @@ while that switch is executing.
880882A switch statement may have a label, and it may contain labeled and unlabeled break ([§8.5.1][§8.5.1]) and
881883continue ([§8.5.2][§8.5.2]) statements.
882884
883- If *switch-condition* is `-file ` *switch-filename*, instead of iterating over the values in an
885+ If *switch-condition* is `-File ` *switch-filename*, instead of iterating over the values in an
884886expression, the switch iterates over the values in the file designated by *switch-filename*.The file
885887is read a line at a time with each line comprising a value. Line terminator characters are not
886888included in the values.
@@ -901,13 +903,13 @@ for ($i = 0; $i -lt $s.Length; ++$i) {
901903 }
902904}
903905
904- switch -wildcard ("abc") {
906+ switch -Wildcard ("abc") {
905907 a* { "a*, $_" }
906908 ?B? { "?B? , $_" }
907909 default { "default, $_" }
908910}
909911
910- switch -regex -casesensitive ("abc") {
912+ switch -Regex -CaseSensitive ("abc") {
911913 ^a* { "a*" }
912914 ^A* { "A*" }
913915}
0 commit comments