Quantcast
Viewing latest article 5
Browse Latest Browse All 11

Ruby Tips #363 – Eql? versus == with Numerics

These two operator in Ruby look similar but can have different results when comparing Numeric operators.

1.0 == 1 #=> true
1.eql? 1 #=> false

As stated in the docs only override the ‘==’ if needed.

:)


Viewing latest article 5
Browse Latest Browse All 11

Trending Articles