Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyfreeze and immutabilitySingle-choice MCQ

A frozen Struct instance holds a mutable array. Which statement describes what these two lines do?

Point = Struct.new(:coords) p = Point.new([1, 2]).freeze p.coords = [9, 9] # line A p.coords << 99 # line B