Created
March 19, 2012 13:41
-
-
Save nickyp/2112612 to your computer and use it in GitHub Desktop.
default parameter references another parameter
This file contains hidden or 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
foo = {:foo => "bar", :olaf => "polaf"} | |
bar = 2 | |
def olaf(one, two = one[:foo]) | |
puts "#{one} - #{two}\n" | |
end | |
olaf(foo) | |
olaf(foo, bar) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment