Colonel Panic Colonel Panic - 1 year ago 221
Powershell Question

Boolean literals in PowerShell

What are the boolean literals in PowerShell?

Answer Source

$true and $false.

Those are constants, though. There are no language-level literals for booleans.

Depending on where you need them, you can also use anything that coerces to a boolean value, if the type has to be boolean, e.g. in method calls that require boolean (and have no conflicting overload), or conditional statements. Most non-null objects are true, for example. null, empty strings, empty arrays and the number 0 are false.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download