I'm new to Powershell and I'm confused about something, more specifically null and $null.
For example. let's say you have a function:
function myFunction([ref]$foo){ if($foo -ne $null){ ...do stuff } } And when you call this function, you do so like:
[ref]$foo = $null myFunction $foo If you execute the code above, the condition if($foo -ne $null) will return true.
However, if you call the function like:
$foo = $null myFunction $foo the condition if($foo -ne $null) will return false.
Why is this? Why is it that when you assign a ref variable $null, it isn't considered null when it is checked?