title: Why does explicit return make a difference in a Proc?
body: <pre><code>def foo
    f = Proc.new { return "return from foo from inside proc" }
    f.call # control leaves foo here
    return "return from foo" 
  end
  
  def bar
    b = Proc.new { "return from bar from inside proc" }
    b.call # control leaves bar here
    return "return from bar" 
  end
  
  puts foo # prints "return from foo from inside proc" 
  puts bar # prints "return from bar" 
  </code></pre>
  
  <p>I thought the <code>return</code> keyword was optional in Ruby and that you are always <code>return</code>ing whether you request it or not. Given that, I find it surprising that <code>foo</code> and <code>bar</code> have different output determined by the fact that <code>foo</code> contains an explicit <code>return</code> in <code>Proc f</code>. </p>
  
  <p>Does anyone know why this is the case?</p>