是否有一个ruby命令告诉ruby脚本关闭自己?我要做的是:假设我正在运行ruby.rb
print "What would you like to do next?"
next=gets.chomp
next.downcase!
if next=="close"
#this is where i want to be able to tell the program to close itself.
end
是否有办法做到这一点,如果有,是什么?
直接使用
exit
更多信息:http://www.sitepoint.com/exit-exit-abort-raise-get-me-outta-here/