Created
September 14, 2010 20:10
-
-
Save simonoff/579678 to your computer and use it in GitHub Desktop.
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
def meth1 | |
puts "method start" | |
pr = lambda { return } | |
pr.call | |
puts "method end" | |
end | |
def meth2 | |
puts "method start" | |
pr = Proc.new { return } | |
pr.call | |
puts "method end" | |
end | |
def meth3 | |
puts "method start" | |
pr = proc { return } | |
pr.call | |
puts "method end" | |
end | |
puts "Using lambda" | |
meth1 | |
puts "--------" | |
puts "using Proc.new" | |
meth2 | |
puts "--------" | |
puts "using proc" | |
meth3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment