From: Martin DeMello Date: 2003-05-30T23:31:34+09:00 Subject: Re: Iteration - last detection Paul Brannan wrote: > 2) Both solutions have the problem of not being able to distinguish > between [] and [nil]. Also, "if prev yield prev" fails if there's a nil or a false in the array. That's why you need (afaics) an explicit flag to say 'this is the first iteration; prev has no value'. I tried leaving prev undefined and rescuing NameError instead, but then the value doesn't persist beyond the block. martin