title: Multiple If-Else Statements VS. Switch Statements within While Loop for C Language
body: <p>This is my first post here. Learning C for the first time to build a robot! :)</p>
  
  <p>Are switch statements a better alternative to express the multiple if-else statements below? I mean this snippet of code works fine. But I'm just really curious about switch statements and want to learn about them.</p>
  
  <p>If yes, I'm not exactly sure how to do them. I've googled extensively but just feel more and more intimidated by the complex programs out there. :/</p>
  
  <pre><code>while(1)
  {
      signed float A;
  
      A = get_angle();    
  
      if (A &gt; 540 &amp;&amp; A &lt;= 700)
      {
          put_speed(200, 600);       //function to specify duty cycle and speed
      }
      else if (A &gt; 1 &amp;&amp; A &lt;= 180)
      {
          put_speed (600, 200);
      }   
      else if (A &gt; 180 &amp;&amp; A &lt;= 360)
      {
          put_speed(600, 100);
      }   
      else if (A &gt; 360 &amp;&amp; A &lt;= 540)
      {
          put_speed(100, 600);
      }   
      else
      {
          put_speed(600, 600);
      }
  }   // End of While
  </code></pre>