From: Jamey Cribbs Date: 2008-09-11T01:21:16+09:00 Subject: Re: How to operate on 2 arrays simultaneously? Take a look at the zip method. Jamey On Wed, Sep 10, 2008 at 11:59 AM, DanDiebolt.exe wrote: >>There has got to be a more elegant solution than this. > > I use .each_with_index to walk parallel arrays: > > a=[1,2,3] > b=%w(x y z) > a.each_with_index do |item,index| > puts "item=#{item} index=#{index} a[#{index}]=#{a[index]} b[#{index}]=#{b[index]}" > end > > >