Created
March 15, 2009 00:53
-
-
Save snuxoll/79250 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
# Adds the two arguments passed in to the method | |
def add(num1, num2) | |
num1 + num2 | |
end | |
# We have an array that we want to pass in to add, | |
# with each item as a seperate argument | |
my_args = [1, 2] | |
# Prefixing a variable name with a * will attempt | |
# to break it into components and send each as a | |
# seperate argument | |
puts add(*my_args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment