From: David Vallner Date: 2006-02-13T05:23:47+09:00 Subject: Re: Rescuing blocks? Dňa Nedeľa 12 Február 2006 20:39 Mark Volkmann napísal: > On 2/12/06, Lou Vanek wrote: > > this works, > > > > foo = [1, 2, 3] > > > > foo.each do |o| > > begin > > raise "Oh noes, it's number 2!" if o == 2 > > rescue Exception => e > > puts e.to_s > > end > > end > > Sure it works, but Daniel wants to reduce the syntax a bit AND exit > the loop if an exception is raised without having to specify that. I > like his suggestion. > > -- > R. Mark Volkmann > Partner, Object Computing, Inc. It would cause a little inconsistency with the curly brace form of blocks. Either the rescue clause would have to work only for the do / end form, or we'd be mixing braces and keywords in a single construct, which I couldn't bear to look at. David Vallner