Skip to content

Commit a0b2502

Browse files
YuriySamorodovSean Wheeler
authored andcommitted
Line 192 Single Quote Breaks Example (#1930)
* Line 192 Single Quote Breaks Example * clarified the example for -Regex
1 parent 6686c23 commit a0b2502

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
ms.date: 2017-12-01
2+
ms.date: 2017-12-06
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
@@ -167,9 +167,9 @@ Switch has the following parameters:
167167
| |condition. Wildcard and Exact are ignored. Also, if the |
168168
| |match clause is not a string, this parameter is ignored. |
169169

170+
In this example, there is no matching case so there is no output.
170171

171172
```powershell
172-
Example:
173173
PS> switch ("fourteen")
174174
{
175175
1 {"It is one."; Break}
@@ -179,7 +179,12 @@ Example:
179179
3 {"Three again."; Break}
180180
"fo*" {"That's too many."}
181181
}
182+
```
183+
184+
For the word "fourteen" to match a case you must use the **-Wildcard** or
185+
**-Regex** parameter.
182186

187+
```powershell
183188
PS> switch -Regex ("fourteen")
184189
{
185190
1 {"It is one."; Break}
@@ -189,6 +194,11 @@ Example:
189194
3 {"Three again."; Break}
190195
"fo*" {"That's too many."}
191196
}
197+
```
198+
199+
Result:
200+
201+
```Output
192202
That's too many.
193203
```
194204

0 commit comments

Comments
 (0)