From: Joel VanderWerf Date: 2003-01-31T15:38:57+09:00 Subject: Re: break out of a loop Vivek Nallur wrote: > Is there an idiomatic(or more elegant way) of finding out whether I exited > a loop normally or because of an exceptional condition? > > e.g > found = catch :found do > 10.times{ > # some processing > > #if (some condition) throw :found, true > break > end > > #further processing false > } end > > # here i want to know if I came out because of the break or after looping > 10 times. if found ... This works in 1.6, too.