Here's another mind-bender you may run into (and it's a VERY COMMON coding error!):
$a = 1,2,$null,4
"There's a `$null in `$a, but `$a is an array"
if ($a -eq $null){
"`$a is `$null"
}
else{
"`$a is not `$null"
}
"You'd expect to get either `$True or `$false for that! But . . . uh-oh!
"===" # just a separator
"`$a isn't `$null"
$null -eq $a
To avoid this kind of conundrum, ALWAYS ALWAYS ALWAYS place the $null on the LEFT SIDE of the comparison.
If you need help understanding why that happens, and why there's a missing $true/$false, leave a comment. :-)