Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Integer#==

(untyped other) -> bool
self == other → true or false

Alias of #===

Returns whether self is numerically equal to other:

Example
1 == 2     #=> false
1 == 1.0   #=> true

Related: Integer#eql? (requires other to be an Integer).

See also #=== #<=> #<= #> also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0