title: Trying to avoid "spaghetti code", why is multiple if-else bad?
body: <p>I was just reading the <a href="http://www.webmasterworld.com/forum88/2884-4-30.htm" rel="nofollow noreferrer">top 100 signs of spaghetti code</a> and I came across number 4, which simply states:</p>
  
  <pre><code>if ($status == "awake"){ 
      $actitivity = "Writing spaghetti code"; 
  } else if ($healthstatus == "OK"){ 
      $activity = "Sleep"; 
  } else { 
      print "CALL 911 IMMEDIATELY!"; 
  }
  </code></pre>
  
  <p>I've seen this multiple if-else pattern in <a href="https://stackoverflow.com/questions/195520/what-is-spaghetti-code#198276">other spaghetti discussions</a>.  I'm a little confused why this is, and even if it's applicable to this example.</p>
  
  <p>Is the above example bad because</p>
  
  <ul>
  <li><p>the first variable is <code>actitivity</code> which indicates the coder needs some sleep, so it's a joke, or</p></li>
  <li><p>view shouldn't be being output during logic, or</p></li>
  <li><p>something about too many if/else</p></li>
  </ul>
  
  <hr>
  
  <p><em>EDIT</em> never mind this second part, it's bad because of nested conditionals and multiple returns</p>
  
  <p><s>In the <a href="https://stackoverflow.com/questions/195520/what-is-spaghetti-code#198276">other spaghetti discussions</a> link, is it bad because</s></p>
  
  <p><s>- the logic has <code>return</code> in it, which breaks the flow, or</s></p>
  
  <p><s>- there's too many <code>if/else</code> piled on top of eachother...?</s></p>