title: Convert for loop to if
body: <p>Hi. I have written a function that shifts LEDs to right.
  I used <code>for</code> loop and I want to convert it to <code>if</code> statements.</p>
  
  <pre><code>#include &lt;mega8535.h&gt; 
  #include &lt;delay.h&gt;   
  
  void main(void) {
      int bits = 0b11111110;  
      int i;              
      int j;              
      PORTA = 0xFF;   
      DDRA = 0xFF;   
  
      for(j = 0; j &lt; 5; j++) {
          for(i = 0; i &lt; 8; i++) {  
              PORTA = ((bits &lt;&lt; i) | (bits &gt;&gt; 8-i));  
              delay_ms(500);                                                      
          }                                                   
          PORTA = 0b11111110;                                  
      }      
      PORTA = 0xFF;                       
  }
  </code></pre>
  
  <p>How can I do that?</p>