开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜