Struct creates small data-handling classes on the fly : Struct « Class « Ruby






Struct creates small data-handling classes on the fly


Person = Struct.new(:name, :age)
me = Person.new("Fred Bloggs", 25)
me.age += 1

 

Related examples in the same category