From: "David J. Hamilton" Date: 2011-03-01T06:46:00+09:00 Subject: Re: Comining Arrays Excerpts from Paul Sholtz's message of Mon Feb 28 12:31:12 -0800 2011: > That is, I'm stepping through one array, and then I'm "counting" to keep > track of where I am in the other array, so as to "add" the two arrays. > > I know (before calling the routine) that both arrays are of the same > size, and that elements of the corresponding arrays will be added > together. Sounds like you want zip. %w( a b c ).zip( 1..3 ).each {|l, d| puts "# l:#{l}, d:#{d}" } # l:a, d:1 # l:b, d:2 # l:c, d:3 # => [["a", 1], ["b", 2], ["c", 3]] -- med v辰nlig h辰lsning David J. Hamilton