From: Martin DeMello Date: 2004-04-12T18:24:15+09:00 Subject: Re: zip block oddities/bug? Charles Comstock wrote: > irb(main):009:0> (1..3).zip([4,5,6]) {|x| p x;} > [1, 4] > [2, 5] > [3, 6] > => nil > > I don't follow why it was decided that the final result be nil, it would > be nice if returned the results from the block, meaning the above > example would result in: > > irb(main):009:0> (1..3).zip([4,5,6]) {|x| p x; x} > [1, 4] > [2, 5] > [3, 6] > => [[1, 4],[2, 5], [3, 6]] Think of the block zip as equivalent to 'each' - it iterates over the result set, but never actually collects it. martin