From: "Joe Wölfel" Date: 2008-10-02T22:06:27+09:00 Subject: Re: ruby1.9 block scope Yes. You are right. In that case might be good to not perform a regular expression match on every element. res = a.reverse.find { |e| e =~ /foo/ } On 2 oct. 08, at 00:41, Daniel DeLorme wrote: > Joe Wölfel wrote: >> On 1 oct. 08, at 04:18, Brian Candler wrote: >>> >>> def my_find(a) >>> # res=nil not needed! >>> a.each { |e| res = e if e =~ /foo/ } >>> res >>> end >> res = a.find { |e| e =~ /foo/ } > > Actually that has a slightly different effect. > Brian's my_find finds the *last* matching expression. ;-) > >