Why is Proc in ruby return before executing remaining codes in a method from which Proc was called?
def hello
a = Proc.new{ return }
a.call
puts "Hello"
end
def proc
hello
puts "Proc"
end
Here return
will skip puts "Hello"
and prints only puts "Proc"
But lambda
prints puts "Hello"
as well.
What's the reason for this?