Intermediate
Ruby
Q49 / 100
What is the difference between "==", "equal?", and "eql?" in Ruby?
Correct! Well done.
Incorrect.
The correct answer is B) == checks value equality (often overridable), equal? checks object identity (same object_id), and eql? checks value and type equality (used by Hash keys)
B
Correct Answer
== checks value equality (often overridable), equal? checks object identity (same object_id), and eql? checks value and type equality (used by Hash keys)
Explanation
== is typically overridden for value comparison, equal? checks if two references point to the same object, and eql? additionally requires the same type (e.g. 1.eql?(1.0) is false).
Progress
49/100