On Wed, Oct 29, 2003 at 05:36:01AM +0900, Daniel Carrera wrote:The xor operator in Ruby is ^ (just one). It serves as both bitwise> Hi all,
> I'm trying to figure out what the boolean "xor" operator is in Ruby. I
> thought it was "^^" but that doesn't work. I searched through PickAxe and
> couldn't find a mention of xor.
> Does Ruby have an xor?
and Boolean, depending on its arguments:
irb(main):001:0> 2 ^ 1
irb(main):002:0> true ^ false
irb(main):003:0> true ^ true