In Powershell 7.2 Write-Output ($false || $true)
will output False
. Why?
CodePudding user response:
Because it's not "logical OR", that would be -or
or -bor
. It is doing "if the first command failed, run the second one".
Referencing the variable $false
doesn't fail, so referencing the variable $true
isn't executed.
For comparison, try asdfg || $true
, if the command is not found, you get an error and then $true
.