title: How to flatten arrow code in Scala
body: <p>I know that arror code is an anti-pattern that we should avoid.
  this link:
  <a href="https://blog.codinghorror.com/flattening-arrow-code/" rel="nofollow noreferrer">https://blog.codinghorror.com/flattening-arrow-code/</a></p>
  
  <p>Gives several ways to fix it. However, seems it won't apply for Scala. Especially when I want to return early at the beginning of the method if some condition is not met because "return" keyword is not encouraged in Scala.</p>
  
  <p>Is there an elegant way to allow me do the following in Scala?</p>
  
  <pre><code>def someFunction(): Try[MyDataType] = {
    if(some condition not met){
      // exit function
    }
    // do my actual work
  }
  </code></pre>