From: "Brian Schröder" Date: 2006-07-22T05:36:18+09:00 Subject: Re: contine after exception On 21/07/06, junkone@rogers.com wrote: > How do i continue a loop after a exception? It actually captures the > exception . How do i get the exception handler to start executing from > 4 to call the printstuff function? > > > def printStuff(inpu) ## just print stuff > puts "printing" + inpu.to_s > if (inpu==3) > raise RetryException.new(true) > end > # raise RuntimeError > end > def enter1 > begin > [1,2,3,4,5,6,7,8].each{|value| printStuff(value)}#call function > to print. > > > rescue RetryException > > puts " inside rescuedo nothing" > ###QUESTION: how to continue calling > #puts dd.okToRetry > > rescue > puts "other exception" > ensure > puts "insode ensire" > end > end > end > > > Try with (1..8).each do | value | begin raise "Exception" if value == 3 puts value rescue puts "That was exceptional" end end cheers, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/