Does ruby have nor? -
ruby has conditional unless
.
does have nor
?
e.g.
unless 1 == 2 nor 1 == 3 "nothing equal" else "something's equal" end
ruby doesn't have built-in nor, extend built-in booleans so:
class trueclass def nor(other) false end end class falseclass def nor(other) !other end end
and write
unless (1 == 2).nor(1 == 3) "nothing equal" else "something's equal" end
Comments
Post a Comment