如何SystemExit表现与其他Exceptions 不同?我想我明白了一些关于为什么它的推理不会是很好的提高适当的异常.例如,您不希望发生类似这样的奇怪事件:
begin
exit
rescue => e
# Silently swallow up the exception and don't exit
end
Run Code Online (Sandbox Code Playgroud)
但怎么也该rescue忽略SystemExit?(它使用什么标准?)
在编写Ruby(客户端脚本)时,我看到了三种构建更长字符串的方法,包括行结尾,所有这些对我来说都"难闻".
有没有更清洁,更好的方法?
if render_quote?
quote = "Now that there is the Tec-9, a crappy spray gun from South Miami."
quote += "This gun is advertised as the most popular gun in American crime. Do you believe that shit?"
quote += "It actually says that in the little book that comes with it: the most popular gun in American crime."
quote += "Like they're actually proud of that shit."
puts quote
end
Run Code Online (Sandbox Code Playgroud)
if render_quote?
quote =<<EOS
Now that there …Run Code Online (Sandbox Code Playgroud)