Created
September 20, 2013 13:23
-
-
Save ngpestelos/6637480 to your computer and use it in GitHub Desktop.
returning from a Proc
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
# see Metaprogramming Ruby, p. 80 | |
def another_double | |
p = Proc.new { return 10 } | |
result = p.call | |
return result * 2 # will not pass here | |
end | |
puts another_double |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment