From: Jeremy Bopp Date: 2010-09-30T05:19:37+09:00 Subject: Re: Accessing variables of instances in an array? On 9/29/2010 3:15 PM, Paul Roche wrote: > Jeremy Bopp wrote: >> On 9/29/2010 2:45 PM, Paul Roche wrote: >>> >>> >>> How can I print out specific variables for each instance? >>> >>> >>> eg variables... >>> >>> name >>> age >> >> an_arry.each { |item| puts "#{item.name} #{item.age}" } >> >> -Jeremy > > Thanks Jeremy, that does the job. By the way is 'item' a keyword? No, item is not a keyword. You can replace that with any valid variable name. When you start using other methods that take blocks, you'll find that you can use more than one variable within the | ... | as well. Some blocks even take an empty list. -Jeremy