Skip to content
instance method

Integer#&

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

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

Example
"%04b" % (0b0101 & 0b0110) # => "0100"

Raises an exception if other is not an Integer.

Related: Integer#| (bitwise OR), Integer#^ (bitwise EXCLUSIVE OR).

See also #% #* .try_convert #** also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0