Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyStruct and DataSingle-choice MCQ

How do `Struct` and `Data` differ in supported construction styles and equality, given identical members?

S = Struct.new(:a, :b) D = Data.define(:a, :b) # positional vs keyword construction S.new(1, 2); S.new(a: 1, b: 2) # Struct (Ruby 3.2+) D.new(1, 2); D.new(a: 1, b: 2) # Data