From: Alan Chen Date: 2001-11-14T07:27:27+09:00 Subject: [ruby-talk:25092] Re: exiting blox On Wed, Nov 14, 2001 at 07:19:05AM +0900, David Alan Black wrote: > Hello -- > > On Wed, 14 Nov 2001, Niko Schwarz wrote: > > > 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) > > Doesn't break do what you want? Or am I confused about what > it does? break also stops any subsequent yields to the block. I think Niko just wants to skip the rest of the block for that yield. -- Alan Chen Digikata LLC alan@digikata.com http://digikata.com