Reputation: 197
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?
Upvotes: 5
Views: 11187
Reputation: 11628
abort("No results were returned for that query") unless condition
or
unless condition
abort("No results were returned for that query")
end
Upvotes: 11