Created
March 15, 2009 16:39
-
-
Save snuxoll/79472 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 two named arguments passed in, named :first and | |
# :second respectively | |
def add(args) | |
args[:first] + args[:second] | |
end | |
# Call it using 1.8 and below style | |
puts add(:first => 2, :second => 4) # 6 | |
# Call it using the 1.9 style hash syntax | |
puts add(first: 2, second: 4) # 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment