What is the diff开发者_高级运维erence between exit and exit! in ruby?
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
精彩评论