So, I played a little with PowerShell and came across a somewhat unexpected result in the following code
function returns_true(){ return $true } function returns_false(){ return $false } if (returns_true -eq $true){ Write-Host "I return true" } if (returns_false -eq $false){ Write-Host "I return false" } $myval = returns_false Write-Host $myval
Running this gives me the following output
I return true False
I expected this to return either
I return true I return false False
or simply
False
Can someone explain what is happening here. What does PowerAhell do under the hood, which allows me to evaluate -eq $true , but not -eq $false , when I return $true and $false ?
source share