From: Ross Bamford Date: 2006-11-27T02:28:05+09:00 Subject: Re: find index of first non zeo value in array On Mon, 2006-11-27 at 01:00 +0900, James Edward Gray II wrote: > I believe there has been talk in the past of having index() take a > block for matching. That would solve this problem ideally. I can > submit an RCR if people think it's worth it, but I'm pretty sure Matz > said it was OK last time it came up... (Correct me if I am wrong!) IIRC Matz accepted it straight into 1.9. It's implemented there now: $ ruby9 -ve 'p [0,0,0,15,0].index { |e| e > 0 }' ruby 1.9.0 (2006-11-26 patchlevel 0) [i686-linux] 3 -- Ross Bamford - rosco@roscopeco.REMOVE.co.uk