From: Gavin Sinclair Date: 2003-01-31T16:16:13+09:00 Subject: Re: break out of a loop On Friday, January 31, 2003, 5:26:39 PM, Vivek wrote: > Is there an idiomatic(or more elegant way) of finding out whether I > exited a loop normally or because of an exceptional condition? The key word is "exceptional". Using exception handling is a good option for what you want. class ApplicationException < Exception; end begin 10.times do # some processing raise ApplicationException if some.condition # further processing end rescue ApplicationException # error handling end Just in case you're unfamiliar with exception handling in general, be aware that you needn't even handle it there. If the loop code was in a method "foo", you can do this: begin foo rescue ApplicationException ... end The Pickaxe has all the details. Regards, Gavin