Skip to content

Instantly share code, notes, and snippets.

@Denommus
Created March 17, 2013 02:19
Show Gist options
  • Save Denommus/5179264 to your computer and use it in GitHub Desktop.
Save Denommus/5179264 to your computer and use it in GitHub Desktop.
A more practical example what a closure could do if well used.
x = 0
[4, 2, 6, 7].each do |y|
x += y
end
puts x # writes 19 on the screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment