When do simple parenthetical grouping matter in PowerShell code?
Here's one example when using parenthesis matters (thanks to Boe Prox for inspiring this example):
<#c:#> 'abc' >xo<#c:#> gc xo | set-content xo set-content : The process cannot access the file 'C:\users\larry\documents\windowspowershell\xo' because it is b used by another process. At line:1 char:9+ gc xo | set-content xo+ ~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [Set-Content], IOException+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.SetContentCommand<#c:#> 'abc' >xo<#c:#> (gc xo) | set-content xo<#c:#> type xo abc
Here's an example of arithmetic expression evaluation and added parenthesis
<#c:#> 10*100+1000 2000<#c:#> 10*(100+1000) 11000<#c:#>
Are there other coding examples using PowerShell where adding parenthesis changes the semantics of a statement?