title: How to use if-else statement with function returns?
body: <p>I always try to avoid nested statements. </p>
  
  <p>They lead me into putting code into a long curly braces. It becomes hard to follow the code when the amount of code with in each condition becomes larger.</p>
  
  <pre><code>if(condtion) {
  
  } else if(condition2) {
  
  } else {
  
  }
  </code></pre>
  
  <p>So if I have code like this:</p>
  
  <pre><code>void doSomething(){  
      if(condtion) {
          return;
      } else if(condition2) {
          return;
      } else {
          return;
      }    
  }
  </code></pre>
  
  <p>I always change it to this form (I avoided the <code>else</code> as there is a <code>return</code> statement from each condition):</p>
  
  <pre><code>void doSomething() {
      if(condtion) {
          return;
      }    
      if(condition2) {
          return;    
      }
      return;
  }
  </code></pre>
  
  <p>But someone told me mine is a bit hard to read, which one is better?</p>