Skip to content

Instantly share code, notes, and snippets.

@nickdesaulniers
Last active December 11, 2015 03:18
Show Gist options
  • Save nickdesaulniers/4536257 to your computer and use it in GitHub Desktop.
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