Skip to content

Instantly share code, notes, and snippets.

@sharmaabhinav
Created September 18, 2014 07:04
Show Gist options
  • Select an option

  • Save sharmaabhinav/f04d948b61836434df7c to your computer and use it in GitHub Desktop.

Select an option

Save sharmaabhinav/f04d948b61836434df7c to your computer and use it in GitHub Desktop.
class LocalVariableDemo
def method
1
end
def demo_method
puts method # will call method with name "method"
method = 1 if false # Here local variable come in picture
puts method # nil , local variable
end
end
obj = LocalVariableDemo.new
obj.demo_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment