Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Raise exception

puts fibonacci(2)
puts fibonacci(-1)
puts fibonacci(3)

def fibonacci(num)
  if num < 0
    raise "Invalid number"
  end
  # ...
  return num
end