Skip to content
instance method

Integer#^

(::Integer) -> ::Integer
self ^ other → integer

Bitwise EXCLUSIVE OR; each bit in the result is 1 if the corresponding bits in self and other are different, 0 otherwise:

Example
"%04b" % (0b0101 ^ 0b0110) # => "0011"

Raises an exception if other is not an Integer.

Related: Integer#& (bitwise AND), Integer#| (bitwise OR).

See also #[] #| #>> #~ also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0