consider the following ruby snippet
def foo
Proc.new {return 1}
end
def bar
foo.call
end
def baz
a = Proc.new {return 1}
a.call
end
foo.call # error : unexpected return
bar # error : unexpected return
baz # 1
In the above foo.call throws error because its call in main outside of a function
but why does call to bar fail?
the proc should be called inside a function and the return should be working...