Mega Code Archive

 
Categories / Ruby / Class
 

Use equal to check the references

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 b.equal?(c)      # true: b and c refer to the same object