How can I exit with a message in ruby?

hi guys !

does ruby have a die method ? or is it there a method that displays a
string before exiting ?

···

--
Posted via http://www.ruby-forum.com/.

Kernel#at_exit

You can register handlers that get executed when the program exits.

at_exit {puts "Dying"}
puts "In the program"

You can build your own method to print, such as:

module Kernel
def print_at_exit str
   at_exit {print str}
end
end

print_at_exit "goodbye"

Jesus.

···

On Tue, Sep 2, 2008 at 7:43 AM, Lex Williams <etaern@yahoo.com> wrote:

hi guys !

does ruby have a die method ? or is it there a method that displays a
string before exiting ?

does ruby have a die method ? or is it there a method that displays a
string before exiting ?

abort "bye..."

Hope this helps,

Bill

···

From: "Lex Williams" <etaern@yahoo.com>

Bill Kelly wrote:

From: "Lex Williams" <etaern@yahoo.com>

does ruby have a die method ? or is it there a method that displays a
string before exiting ?

abort "bye..."

Hope this helps,

Bill

Thanks Bill , just what I was looking for .

···

--
Posted via http://www.ruby-forum.com/\.