Created
December 12, 2014 05:14
-
-
Save XxionxX/99a0e543ad64faa2291f to your computer and use it in GitHub Desktop.
Ruby splat demonstration
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 foo(a, *b, **c) | |
print [a, b, c] | |
end | |
foo(10) | |
puts | |
foo(10, 20, 30) | |
puts | |
foo(10, 20, 30, key_a: 40, key_d: 50) | |
puts | |
foo(10, key_a: 40, key_d: 50) | |
puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment