Mega Code Archive

 
Categories / Ruby / Class
 

Same value but different reference

a = "Ruby"       # One reference to one String object b = c = "Ruby"   # Two references to another String object a.equal?(b)      # false: a and b are different objects a.object_id == b.object_id   # Works like a.equal?(b)