Skip to content

Instantly share code, notes, and snippets.

@VikiAnn
Last active August 29, 2015 13:55
Show Gist options
  • Save VikiAnn/8777885 to your computer and use it in GitHub Desktop.
Save VikiAnn/8777885 to your computer and use it in GitHub Desktop.
def add(*numbers)
numbers.sum
end
def subtract(number, *more_numbers)
more_numbers.each do |i|
number -= i
end
number
end
def calculate(number, other_number, options = {})
if options.is_a?(Hash) && options[:subtract]
subtract(number, other_number)
else add(number, other_number)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment