Skip to content

Instantly share code, notes, and snippets.

@ksomemo
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save ksomemo/9550391 to your computer and use it in GitHub Desktop.

Select an option

Save ksomemo/9550391 to your computer and use it in GitHub Desktop.
Rubyのキーワード引数の副作用を確かめてみた
# % ruby -v
# ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
def func(x:[1])
x << 1
p x
end
func(x:[2]) # => [2, 1]
func() # => [1,1]
func() # => [1,1]
# pythonと違って副作用なし
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment