Created
October 27, 2012 23:53
-
-
Save havenwood/3966916 to your computer and use it in GitHub Desktop.
Named Params Ruby 2.0.0
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 why(noun: 'Ruby', adjective: 'exquisite') # parens required or SyntaxError | |
"#{noun} is #{adjective}." | |
end | |
why | |
#=> "Ruby is exquisite." | |
why adjective: 'tasty' | |
#=> "Ruby is tasty." | |
why adjective: 'tasty', noun: 'Bacon' | |
#=> "Bacon is tasty." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment