What is the difference between exit and exit! in ruby?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Couple things:
Exit handlers get run in the “exit” form but not “exit!”. This means any code that is assigned to “clean-up” won’t get run using “exit!”
The “exit status” is default set to false in the “exit!” form, whereas it is true in the “exit” form. The “exit status” is a message to the operating system about the program that is stopping execution.
they are both Kernel methods: http://www.ruby-doc.org/core/classes/Kernel.html