5

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?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
user858642
  • 187
  • 2
  • 2
  • 6

1 Answers1

11
abort("No results were returned for that query") unless condition

or

unless condition
  abort("No results were returned for that query")
end
Chris Ledet
  • 11,458
  • 7
  • 39
  • 47