-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-languageArea - PowerShell syntax and keywordsArea - PowerShell syntax and keywords
Description
The .ForEach and .Where method descriptions in https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Arrays.md currently state:
The syntax requires the usage of curly brackets; parenthesis are optional
-
parenthesis should be parentheses (plural)
-
It's important to clarify that if you do use curly braces only, there must be no whitespace between the method name and the script block (unlike when passing a script block in argument mode; this subtlety is why I personally think omitting the parentheses is ill-advised):
(1, 2, 3).Where{ $_ -ge 2 } # OK
(1, 2, 3).Where { $_ -ge 2 } # !! FAILS due to whitespace between method name and script blockGenerally, it's better to not just refer to the syntax form ("curly brackets"), but to also state the syntactic element's conceptual name (script block).
Version(s) of document impacted
- Impacts 6.next document
- Impacts 6 document
- Impacts 5.1 document
- Impacts 5.0 document
- Impacts 4.0 document
- Impacts 3.0 document
Reason(s) for not selecting all version of documents
- The documented feature was introduced in selected version of PowerShell
- This issue only shows up in selected version of the document
Metadata
Metadata
Assignees
Labels
area-languageArea - PowerShell syntax and keywordsArea - PowerShell syntax and keywords