Difference between $true and $false under the hood Difference between $true and $false under the hood powershell powershell

Difference between $true and $false under the hood


What's actually happening here is that the parser is seeing -eq $true and -eq $false as arguments being passed to the functions.

To see that this is the case, add [CmdletBinding()]Param() to the functions like this:

function returns_true(){[CmdletBinding()]Param()    return $true}


Better explanation as to what's happening:https://stackoverflow.com/a/49115149/9446818

Parentheses help. What you really want is:

if ((returns_true) -eq $true){

and

if ((returns_false) -eq $false){