C
Colin Summers
This seems harder than the usual thing I've been tripping on (and
finding answers in the pickaxe or online).
I have an object: human. It has parts: human.hand human.foot.
How can I say this:
fred = human.new
fred.hand = fred.foot = fred. leg = 'flesh'
fred.knee = 'plastic'
fred.head = 'steel'
parts = [hand,foot,leg,knee]
parts.each do |part|
puts "part #{part} is made of " + fred.{part}.to_s
end # with each part
Am I close?
Thanks,
--Colin
finding answers in the pickaxe or online).
I have an object: human. It has parts: human.hand human.foot.
How can I say this:
fred = human.new
fred.hand = fred.foot = fred. leg = 'flesh'
fred.knee = 'plastic'
fred.head = 'steel'
parts = [hand,foot,leg,knee]
parts.each do |part|
puts "part #{part} is made of " + fred.{part}.to_s
end # with each part
Am I close?
Thanks,
--Colin