Skip to content

Instantly share code, notes, and snippets.

@fronx
Created August 29, 2011 14:38
Show Gist options
  • Select an option

  • Save fronx/1178523 to your computer and use it in GitHub Desktop.

Select an option

Save fronx/1178523 to your computer and use it in GitHub Desktop.
def a
x = 1
y = 2
l = lambda { x + y }
y = 3
l.call
end
puts a # => 4
def a
x = 1
l = lambda { x + y }
y = 3
l.call
end
puts a # => NameError: undefined local variable or method ‘y’ for main:Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment