From: MenTaLguY Date: 2001-11-14T07:47:10+09:00 Subject: [ruby-talk:25099] Re: exiting blox > Hi there, > is there a way to exit a block before time? > like: > > field.each { |el| > if(el.alsacian?) > break #no, dont want anymore > else > puts el > end > } > > is there? (note: i want to exit it just for one el, of course) As someone else already pointed out, you can use throw/catch. I believe that is essentially what Enumerable#find does. I realize this is a matter of taste, but perhaps the following would be more readable? el = field.find { |el| el.alsacian? } puts el if el -mental