Skip to content

Instantly share code, notes, and snippets.

@tkfm-yamaguchi
Last active May 21, 2018 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkfm-yamaguchi/a102d00a1852c01d7ff81ae31585d6af to your computer and use it in GitHub Desktop.
Save tkfm-yamaguchi/a102d00a1852c01d7ff81ae31585d6af to your computer and use it in GitHub Desktop.
It would be nil (local variable) when a method is substituted by itself in Ruby
"method"
"a"
"local-variable"
nil
def a
'a'
end
p defined?(a)
p a
a = a
p defined?(a)
p a
@tkfm-yamaguchi
Copy link
Author

何故…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment