title: Return value of finally block in Scala
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8443743/return-and-try-catch-finally-block-evaluation-in-scala">“return” and “try-catch-finally” block evaluation in scala</a>  </p>
  </blockquote>
  
  
  
  <p>There are two Scala functions:</p>
  
  <p>a): <code>def foo(): Int = try { 1 } finally { 2 }</code></p>
  
  <p>b): <code>def bar(): Int = try { return 1 } finally { return 2}</code></p>
  
  <p>I cannot figure out why <code>foo</code> returns 1 but <code>bar</code> returns 2.</p>