Use === to compare values : eql « Class « Ruby






Use === to compare values



(1..10) === 5    # true: 5 is in the range 1..10
/\d+/ === "123"  # true: the string matches the regular expression
String === "s"   # true: "s" is an instance of the class String
:s === "s"       # true in Ruby 1.9

 








Related examples in the same category

1.eql and == are different