From: Rick DeNatale Date: 2010-11-03T01:36:15+09:00 Subject: Re: Printing out contents of 2 arrays using a loop On Tue, Nov 2, 2010 at 12:19 PM, Paul Roche wrote: > Hi. I'd like to print out the contents of 2 arrays as follows........ > > print array1[0] array2[0] > print array1[1] array2[1] > etc > > array1 holds names > array2 holds occupation > > so an example print out will be....... > > > Joe Bloggs  Carpenter > etc > > > I'm struggling constructing a loop or iteration that prints this out. names = %w(joe sam john fred) occupations = %w(tinker tailor soldier spy) names.zip(occupations).each {|name, occupation| puts "#{name} is a #{occupation}"} -- Rick DeNatale Help fund my talk at Ruby Conf 2010:http://pledgie.com/campaigns/13677 Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale