title: Swift 3 - round-up double of for-loop
body: <p>I'm looking for an <strong>Swift 3 Equivalence</strong> for this C-style for-loop:</p>
  
  <pre><code>double upperBound = 12.3
  for (int i = 0; i &lt; upperBound; ++i) {
    // Do stuff
  }
  </code></pre>
  
  <p>I was thinking about something like this:</p>
  
  <pre><code>var upperBound = 12.3
  for i in 0..&lt;Int(upperBound) {
    // Do stuff
  }
  </code></pre>
  
  <p>A dynamic <code>upperBound</code> ruins the naive approach. The code above won't work for <code>upperBound = 12.3</code>, since <code>Int(12.3) = 12</code>. <code>i</code> would loop through <code>[0, ..., 11]</code> (<em>12 excluded</em>). <code>i in 0...Int(upperBound)</code> won't work for <code>upperBound = 12.0</code>, since <code>Int(12.0) = 12</code>. <code>i</code> would loop through <code>[0, ..., 12]</code> (<em>12 included</em>). </p>
  
  <p>What is the <strong>Swift 3</strong> way of handling situations like this?</p>