From: Christopher Swasey Date: 2008-02-20T08:44:24+09:00 Subject: Re: HELP: Need to continue the loop after the exception On 2/19/08, mirth wrote: > hi guys, > > I'm a ruby newbie. I have a question about how to continuethe loop > after the exception. If anyone here could help me, I really appreciate > that. > > > Right now if there's an exception in looptest, it will exit the loop. > But I want the loop in test_01 to continue the next one even if > there's an exception for the looptest in the previous loop. Is there > anyway to achieve this? I tried "continue", "return","break" and etc. > But nothing works so far. :( I can't replicate the behaviour you describe. Slightly modifying your code to test: def looptest puts "#" raise "Exception" rescue puts "E" end def test_01 [1,2,3,4,5].each do |obj| looptest end end test_01 Simply capturing the exception with a rescue should work fine. This example, for instance, spits out '#\nE' 5 times. Christopher