Skip to content

Amend the Where-Object topic to explain the implicit Boolean logic that may be applied #3357

Closed

Description

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:

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 -gt 0
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.

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

Activity

  1. added a commit that references this issue on Mar 20, 2020
    ecbc875
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-coreArea - Microsoft.PowerShell.Core module

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions