基本上,如果满足某个条件,我只是试图阻止程序运行其余的行。
unless raw_information.first
puts "No results were returned for that query"
break
end
然而,在程序运行之前我得到了这个错误:
无效的休息 编译错误(SyntaxError)
这样做的正确方法是什么?
答案 0 :(得分:11)
abort("No results were returned for that query") unless condition
或
unless condition
abort("No results were returned for that query")
end