Mega Code Archive

 
Categories / Ruby / Class
 

== and equal are different

a = "Ruby"    # One String object b = "Ruby"    # A different String object with the same content a.equal?(b)   # false: a and b do not refer to the same object a == b        # true: but these two distinct objects have equal values