Stop execution of Ruby script

Is there a method like exit or die in PHP which stops the execution of a Ruby script?


Solution 1:

Either abort or exit will help.

Solution 2:

abort is an alias for Kernel.exit(false) which terminates execution immediately.

exit is an alias for Kernel.exit(true) and raises the SystemExit exception, that may be caught. Also at_exit functions and finalizers are run before termination.