如果满足给定条件则结束 ruby 程序
基本上,我只是想在满足特定条件时阻止程序运行其余的行。
unless raw_information.first
puts "No results were returned for that query"
break
end
但是,在程序运行之前我收到此错误:
无效中断 编译错误(语法错误)
执行此操作的正确方法是什么?
Basically, I am just trying to stop the program from running the rest of the lines if a certain condition is met.
unless raw_information.first
puts "No results were returned for that query"
break
end
However, before the program even runs I get this error:
Invalid break
compile error (SyntaxError)
What is the proper way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
或者
or