Created
March 17, 2013 02:19
-
-
Save Denommus/5179264 to your computer and use it in GitHub Desktop.
A more practical example what a closure could do if well used.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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