From: daz Date: 2004-04-12T14:44:16+09:00 Subject: Re: zip block oddities/bug? Simon Strandgaard wrote: > When supplying a block to zip, shouldn't you > be able to affect the output produced by #zip ? > The "output" is inside the block. > No matter what I do it outputs 'nil'.. > > Is this the intented behavier ? > I hope so ;-) > irb(main):020:0> (4..6).zip {|i| p i; nil } > [4] > [5] > [6] > => nil > Does what you asked. Zips 4..6 with your omitted argument and passes the results one at a time to the block. If an array was built at the same time with, say, (4..6000000000) you'd probably run out of memory, disk space for swapping and not be able to complete the operation. Since an array is deliberately *not* being built, what could usefully be returned outside the block ? ("nil" seems like a good choice). daz P.S. Swapfiles can be reset by a reboot. May also need a defrag, which is often a good idea.