Skip to content

Instantly share code, notes, and snippets.

@stej
Created April 17, 2013 14:38
Show Gist options
  • Save stej/5404822 to your computer and use it in GitHub Desktop.
Save stej/5404822 to your computer and use it in GitHub Desktop.
This works:
$a = ''
$b = @('')
( $a -eq $b ) -ne ( $b -eq $a )
now, the ( $a -eq $b ) is true, because $b is converted to string -> all the array members are converted to string and then concatenated by $ofs ->
it equals ('' -eq '') which is true
then ( $b -eq $a ) means (@('') -eq '') - this returns all items from array (left operand) that are equal to right operand -> it's array of ''
now array of '' is converted to boolean value
@('') converted to boolean returns $false probably because there isn't any not-empty string
->
$true -ne $false returns $true
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment