Ruby - Classes and Objects
What will be the output of this Ruby code?
x = "code" y = "code" puts x.equal?(y) puts x == y
x = "code" y = "code" puts x.equal?(y) puts x == y
equal? callx and y are two distinct string objects with the same content, x.equal?(y) returns false.== call== compares content, so x == y returns true.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions