Im reading Jon Skeet book. (#4)
but one thing (among others) caught my eye :
topic : bool?
he wrote in a table that :(X,Y are bool?)
X | Y | X & Y
---------------------------
true null null
ok fine... so the null is the one who decides. the bool operand here looses.
X | Y | X & Y
---------------------------
false null false
why ? why the bool operand here is being taking into account while in the previous sample it was the null who decided about the result ...?
It seems that true and false has friends in different places....:)
Pronounce null as unknown.
true & unknown => unknown
false & unknown => false because the second operand does not matter.
And of course there is the mirror table for OR :
true | unknown => true because the second operand does not matter.
false | unknown => unknown
And it holds for &&
and ||
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With