Created
November 13, 2012 21:26
-
-
Save jdx/4068500 to your computer and use it in GitHub Desktop.
ruby array appends w/ method parameters
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
dickeyxxx@dickey-mbp ~/proj/vagrant 2.0.0-dev (master ✘)✹✚✭ | |
✗✗✗ irb | |
irb(main):001:0> RUBY_VERSION | |
=> "2.0.0" | |
irb(main):002:0> def foo(arr: []) | |
irb(main):003:1> p arr | |
irb(main):004:1> arr << 'x' | |
irb(main):005:1> end | |
=> nil | |
irb(main):006:0> foo | |
[] | |
=> ["x"] | |
irb(main):007:0> foo | |
[] | |
=> ["x"] | |
irb(main):008:0> foo | |
[] | |
=> ["x"] | |
irb(main):009:0> foo | |
[] | |
=> ["x"] | |
irb(main):010:0> foo | |
[] | |
=> ["x"] | |
irb(main):011:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment