Kernel::exit
----------------------------------------------------------- Kernel::exit
     exit( anInteger=0 )
------------------------------------------------------------------------
     Initiates the termination of the Ruby script by raising the
     SystemExit exception. This exception may be caught. The optional
     parameter is used to return a status code to the invoking
     environment.
        begin
          exit
          puts "never get here"
        rescue SystemExit
          puts "rescued a SystemExit exception"
        end
        puts "after begin block"
     produces:
        rescued a SystemExit exception
        after begin block
     Just prior to termination, Ruby executes any at_exit functions and
     runs any object finalizers (see ObjectSpace beginning on page ??).
        at_exit { puts "at_exit function" }
        ObjectSpace.define_finalizer("string",  proc { puts "in
finalizer" })
        exit
     produces:
        at_exit function
        in finalizer



----- Original Message ----- 
From: "Kurt Euler" <keuler / portal.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Friday, August 29, 2003 4:38 PM
Subject: How to end script execution mid-script?


> All
>
> A control flow question: Could someone advise if there is command to end
Ruby scripts operation? For example, if a certain condition is true, then
the script should terminate?
>
> Thanks.
>
>
>
>
>
>