Put the code you want to be executed in ensure:

begin
  error
rescue
ensure
  print "Finishing..."
end

You will get "Finishing..." printed out despite any exception, rescued or
not.

Gennady.

----- Original Message -----
From: "Shannon Fang" <xrfang / hotmail.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Thursday, December 05, 2002 2:21 PM
Subject: on error resume next


> Hi,
>
> In the following code, how can I implement the VB "On Error Resume Next"
> in ruby?
>
> def error
>   raise "ERROR_DELIBERATE"
>   print "I'm back"
> end
> begin
>   error
>   print "Finishing..."
> rescue
>   ???
> end
>
> Can I let my program execute either of the 2 print? If I use retry, it
> will re-run error, and lock the program.
>
> Thanks
> Shannon
>
>
>
>
>