title: How to avoid 'while(true)' with 'break' and rather use a 'for' loop?
body: <p>I have an application with a config file from which various settings are read. One of the settings is the cycles that the application is running.
  If this variable <code>nLoops</code> is <code>-1</code> then it's supposed to run an infinite number of times. Otherwise it shall run <code>x</code> times.
  At the moment this is how I implemented it. However I was wondering if there's a more straight forward way without the <code>while(true)</code> expression (I get a warning here):</p>
  
  <pre><code>//get nLoops from config file
  
  int i = 0;
  while (true)
  {
      if (nLoops &gt; -1 &amp;&amp; i &gt;= nLoops)
          break;
      i++;
  
     // do stuff
  }
  </code></pre>