From: "Florian Groß" Date: 2003-05-27T03:44:01+09:00 Subject: Re: exiting of a block Moin! Emmanuel Touzery wrote: > i actually want to use Enumerable#find, as I do, but with a complex > condition. the problem is that in my condition i have several places to say > "yes, this is the item i want" or "no, it's not the item i want". in a > function i would use return, but in that case, that pops me out of the whole > function, not only of the block. Please also note that 'if' has a return value in Ruby. See http://www.rubycentral.com/book/tut_expressions.html#UH for reference. So your code could be written as: # now find the current program for this # channel. programsForChannel.find { |program| if program.time <= showTime if program.endTime # there is a endtime. # true if we now are before this end true if program.endTime > showTime else # program has no registered # end. true end end } > thanks for the suggestion, > emmanuel Regards, flgr