Guest User

Untitled

a guest
Jun 21st, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. def calculate(*array)
  2. calculation = array.last
  3. if calculation.is_a?(Hash)
  4. numbers = array[0..-2]
  5. else
  6. return add(*array)
  7. end
  8. if calculation[:add]
  9. add(*numbers)
  10. else
  11. subtract(*numbers)
  12. end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment