Skip to content

Instantly share code, notes, and snippets.

@nickdesaulniers
Last active December 11, 2015 03:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nickdesaulniers/4536257 to your computer and use it in GitHub Desktop.
Naive attempt at closure in Ruby
x = 5
def my_closure y
x + 1
end
puts my_closure 10 # NameError: undefined local variable or method `x' for main:Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment