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

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -