Created
September 13, 2015 17:18
-
-
Save toandv/0ee106de4b367e3800bb to your computer and use it in GitHub Desktop.
Ruby lambdas
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
sum = -> (a, b) {puts a + b} | |
sum.call(1 , 2) | |
def block1 | |
lambda { return 100}.call | |
return :lambda | |
end | |
def block2 | |
Proc.new { return :proc}.call | |
return 200 | |
end | |
puts block1 | |
puts block2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment