Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubyfrozen string dedupSingle-choice MCQ

Two strings are built at runtime from the same parts. Why is `a.equal?(b)` false but `c.equal?(d)` true?

a = ("hel" + "lo").freeze b = ("hel" + "lo").freeze c = -("hel" + "lo") d = -("hel" + "lo") p a.equal?(b) p c.equal?(d)