Skip to content

Line 192 Single Quote Breaks Example #1930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
ms.date: 2017-12-01
ms.date: 2017-12-06
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
Expand Down Expand Up @@ -167,9 +167,9 @@ Switch has the following parameters:
| |condition. Wildcard and Exact are ignored. Also, if the |
| |match clause is not a string, this parameter is ignored. |

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

```powershell
Example:
PS> switch ("fourteen")
{
1 {"It is one."; Break}
Expand All @@ -179,7 +179,12 @@ Example:
3 {"Three again."; Break}
"fo*" {"That's too many."}
}
```

For the word "fourteen" to match a case you must use the **-Wildcard** or
**-Regex** parameter.

```powershell
PS> switch -Regex ("fourteen")
{
1 {"It is one."; Break}
Expand All @@ -189,6 +194,11 @@ Example:
3 {"Three again."; Break}
"fo*" {"That's too many."}
}
```

Result:

```Output
That's too many.
```

Expand Down