You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Amend the Where-Object topic to explain the implicit Boolean logic that may be applied #3357
The v6 Where-Object topic now touches on implicit Boolean logic in the context of describing the new -Not parameter, but I don't think that's sufficient:
There is no mention of the positive variation: using just a -Property name and letting PowerShell's implicit to-Boolean coercion interpret the values, irrespective of their input type.
E.g., something like:
PS>'hi','','there'|Where-Object Length # same as: Where-Object -Property Length
hi
there
is the concise equivalent of:
PS>'hi','','there'|Where-Object Length -gt0
hi
there
By relying on 0 evaluating to $false and any nonzero value to $true in a Boolean context, the -gt 0 arguments aren't necessary.
Activity
Fixes #3357 - add boolean discussion (#5610)