From: Jason Sweat Date: 2005-03-11T01:12:40+09:00 Subject: Re: Is iterating in lock-step possible? On Thu, 10 Mar 2005 21:52:43 +0900, Roshan James wrote: > Is there someway I can do something like - > a = [1, 2, 3, 4] > b = [5, 6, 7, 8] > (a.each, b.each) {|a1, b1| > #so that I get one value from a and one from b > } Warning: total Ruby newby naive approach: >> a = (1..4).to_a => [1, 2, 3, 4] >> b = (5..8).to_a => [5, 6, 7, 8] >> a.each_with_index {|av, ai| p [av, b[ai]]} [1, 5] [2, 6] [3, 7] [4, 8] -- Regards, Jason http://blog.casey-sweat.us/