a = "a string"
a === "a string" # => true
a === String # => false
String === "xyz" # => true
"xyz".kind_of? String # => true
(1..5) === 3 # => true
(1..5).include? 3 # => true
/\d/ === "123" # => true
# === is used in "case" statement
b = a
a.equal? b # Returns true if the object_id’s are equal.
1 == 1.0 # => true (do type conversion)
1.==(1.0) # underlying of ==
1.eql? 1.0 # => false (don't do type conversion)
References:
No comments:
Post a Comment