title: Replacement for C-style loop in Swift 2.2
body: <p>Swift 2.2 deprecated the C-style loop. However in some cases, the new range operator just doesn't work the same.</p>
  
  <pre><code>for var i = 0; i &lt; -1; ++i { ... }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>for i in 0..&lt;-1 { ... }
  </code></pre>
  
  <p>The later one will fail at run-time. I can wrap the loop with an <code>if</code>, but it's a bit cluttered. Sometimes this kind of loop is useful.</p>
  
  <p>Any thoughts?</p>
  
  <p><strong>Use cases</strong></p>
  
  <ol>
  <li>You need to enumerate all elements of an array, except the last one.</li>
  <li>You need to enumerate all whole integer numbers in a decimal range, but the range can be like [0.5, 0.9] and so there's no integers (after some maths), which results in an empty loop.</li>
  </ol>