A condition can obviously be false, but I guess that's not what you meant. For the sake of this argument, let's assume that condition c is true, value x is false and y is 1; in most languages, c ? x : y would result in false, whereas c && x || y would result in 1.
If I understood you correctly, c ? false | 1 in leaf would too result in 1, thus breaking the original logic of a ternary operator.
A condition can obviously be false, but I guess that's not what you meant. For the sake of this argument, let's assume that condition
c
is true, valuex
isfalse
andy
is1
; in most languages,c ? x : y
would result infalse
, whereasc && x || y
would result in1
.If I understood you correctly,
c ? false | 1
in leaf would too result in1
, thus breaking the original logic of a ternary operator.No,
c ? false | 1
would evaluate tofalse
in Leaf. The|
operator applies only to optional types, not truthy values.