Skip to content

Instantly share code, notes, and snippets.

@doug7410
Created June 1, 2014 23:34
Show Gist options
  • Save doug7410/e2ea22f32155085a325c to your computer and use it in GitHub Desktop.
Save doug7410/e2ea22f32155085a325c to your computer and use it in GitHub Desktop.
Does a method create it's own scope?
#If you define a method does it create a scope within itself? Don't any variables or methods used within a method need to be passed in as arguments?
#Here's an example
name = "Frank"
def say_hello(n)
def hello_method
"hello"
end
puts hello_method + " #{n}"
end
def hello_again(n)
puts hello_method + " #{n}"
end
say_hello(name)
hello_again(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment