Created
November 11, 2015 00:20
-
-
Save edj979/7a7d088e2b6e80e8f55c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(*numbers) | |
numbers.inject(0) { |sum, number| sum + number } | |
end | |
def add_with_message(message, *numbers) | |
"#{message} : #{add(*numbers)}" | |
end | |
puts add_with_message("The Sum is", 1, 2,32 ,3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment