From: Martin DeMello Date: 2009-02-07T00:31:12+09:00 Subject: Re: iterating over two arrays simultaneously On Fri, Feb 6, 2009 at 8:54 PM, Jean-Denis Muys wrote: > James' solution to the previous question being so much better than mine (which I > did for my learning purposes), I dare asking about how to iterate over two > arrays in parallel. I don't see a way to use the iteration methods, and my > solution below doesn't feel idiomatic at all: > > array1 = [1, 2, 3] > array2 = ["one", "two", "three"] > # note: both arrays are known to be the same size Use the block form of zip: array1.zip(array2) {|i,j| print "#{i} = #{j}\n"} martin