Boolean values

suggest change

$true and $false are two variables that represent logical TRUE and FALSE.

Note that you have to specify the dollar sign as the first character (which is different from C#).

$boolExpr = "abc".Length -eq 3 # length of "abc" is 3, hence $boolExpr will be True
if($boolExpr -eq $true){
    "Length is 3"
}
# result will be "Length is 3" 
$boolExpr -ne $true
#result will be False

Notice that when you use boolean true/false in your code you write $true or $false, but when Powershell returns a boolean, it looks like True or False

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents