abort的使用
abort的使用很多人可能会这样用:
Ruby代码
def stop_error(message)
puts "ERROR: #{message}"
exit(1)
end
stop_error "file doesn't exist!" unless File.exist?(file)
其实,ruby已经为我们内置了一个abort方法。
Ruby代码abort "file doesn't exist!" unless File.exist?(file) 村艹好样的 村艹好样的
zhlong8 发表于 2011-09-22 17:28 http://bbs.chinaunix.net/images/common/back.gif
:handshake
页:
[1]