Difference between == and === in Ruby?

  • == → checks equality of values.
  • === → used in case statements and can behave differently depending on the class.
5 == 5      # true
(1..10) === 5  # true (range check)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *