开发者

what is the difference between exit and exit! in ruby?

开发者 https://www.devze.com 2023-02-16 10:43 出处:网络
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\"

What is the diff开发者_高级运维erence between exit and exit! in ruby?


Couple things:

  1. 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!"

  2. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号