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

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

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