From: nobu.nokada@... Date: 2004-01-16T23:01:14+09:00 Subject: Re: Enumerable#find Hi, At Fri, 16 Jan 2004 22:50:38 +0900, Hal Fulton wrote: > >>Would it make sense to allow #find to take an argument or a block > >>(but not both)? > > > > > > It conflicts current spec, which takes the value when nothing > > found. You would need another name. > > I don't understand. Do you mean this has changed in 1.8? > > find traditionally has returned nil when it fails. Sorry, it was wrong a little. Enumerable#find calls the optional parameter `ifnone' and returns its result, when no object matches. In 1.6 or former, nil returned regardless of the result. > Can you give me an example? $ ruby -e 'p [1,2,3].find(proc{puts "not found"; true}){|x|x.zero?}' not found true -- Nobu Nakada