Booleans

Boolean (true or false) variables are most commonly initialized to their literal values of $true and $false. When it evaluates them as part of a Boolean expression (i.e., an “if” statement,) though, PowerShell maps results into a suitable Boolean representation.

Windows PowerShell Boolean interpretations

Result

Boolean representation

$true

True

$false

False

$null

False

Nonzero number

True

Zero

False

Nonempty string

True

Empty string

False

Nonempty array

True

Empty array

False

Hashtable (either empty or not)

True

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.195.110