From: James Gray Date: 2008-09-11T00:52:19+09:00 Subject: Re: How to operate on 2 arrays simultaneously? On Sep 10, 2008, at 10:42 AM, Patrick Doyle wrote: > There has got to be a more elegant solution than this. Suppose I have > 2 identical length arrays that I want to add together to produce a > third array. The best solution I've come up with is: > > c = (0...a.size).map {|i| a[i] + b[i]} > > Any suggestions? a.zip(b).map { |l, r| l + r } Hope that helps. James Edward Gray II