Created
March 20, 2015 10:44
-
-
Save launchkit-codes/be420735e95cc656261a to your computer and use it in GitHub Desktop.
What's closure concept?
This file contains hidden or 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
| def add(a) | |
| return Proc.new do |b| | |
| a + b | |
| end | |
| end | |
| addition = add(4) | |
| puts addition.call(5) # => 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment