Type of issue
Missing information
Feedback
Local: - Specifies that the name exists in the Local scope. The current scope is always the Local scope.
There is a slight difference between the Local: scope and the default scope rules which doesn't come forward from the documentation:
When the Local: scope modifier is used, PowerShell doesn't search the scope hierarchy, starting with the current scope and proceeding through each parent scope and If it finds a match, the value of the item is retrieved from the scope where is was found, it just creates a new item in the current scope.
This feature could actually be useful for self-initializing counters, see: PowerShell/PowerShell#26645
Page URL
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7.5
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.5/Microsoft.PowerShell.Core/About/about_Scopes.md
Author
@sdwheeler
Platform Id
1315b401-775e-d203-ea11-323e346a0f81
Document Id
42772fd1-35e3-2672-05b1-3e5cd9c31ecf
Type of issue
Missing information
Feedback
There is a slight difference between the
Local:scope and the default scope rules which doesn't come forward from the documentation:When the
Local:scope modifier is used, PowerShell doesn't search the scope hierarchy, starting with the current scope and proceeding through each parent scope and If it finds a match, the value of the item is retrieved from the scope where is was found, it just creates a new item in the current scope.This feature could actually be useful for self-initializing counters, see: PowerShell/PowerShell#26645
Page URL
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7.5
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.5/Microsoft.PowerShell.Core/About/about_Scopes.md
Author
@sdwheeler
Platform Id
1315b401-775e-d203-ea11-323e346a0f81
Document Id
42772fd1-35e3-2672-05b1-3e5cd9c31ecf