title: No condition in a for loop?
body: <p>(Sorry in advance, this question is probably very simple. I write code as a hobby and am just trying to wrap my mind around some things right now.)</p>
  
  <p>I recently encountered a loop statement like (<code>n</code> is a previously set positive integer):</p>
  
  <pre><code>int cnt;
  for(cnt=0; n; cnt++){
      n &amp;= n - 1;
  }
  </code></pre>
  
  <p>If I understand correctly, the middle entry in a loop should be a condition, but <code>n;</code> does not seem to be a condition at all. Unless if it is understood as a bool (<code>true</code> if <code>n!=0</code> and <code>false</code> if <code>n==0</code>). If this is the correct way to think about it, would the following code be perfectly equivalent to the above?</p>
  
  <pre><code>int cnt=0;
  while(n&gt;0){
      n &amp;= n - 1;
      cnt++;
  }
  </code></pre>
  
  <p>If yes, why would one choose the former style of writing this instead of the while loop? It seems to me that a while loop would be the most clear and intuitive choice here, so I wonder if there is any advantage in the for loop that I missed? Thanks for any suggestion!</p>