title: Should I use an if or switch Statement? Objective-C
body: <p>I have always wondered but can't find a definitive answer. When should I use either an 'if' or 'switch' statement. When is one better than the other?</p>
  
  <p>For example I could do:</p>
  
  <pre><code>-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
      switch (buttonIndex) {
          case 0:
              //Stuff
              break;
  
          case 1:
              //Stuff
              break;
  
          default:
              break;
      }
  
  //OR
  
      if (buttonIndex == 0) {
          //Stuff
      }
      if (buttonIndex == 1) {
          //Stuff 
      }
  }
  </code></pre>
  
  <p>This is just an example, but I'm sure in different situations to this it would matter differently.</p>