title: How to create an array with incremented values in Swift?
body: <p>I know that I can create an array with repeated values in Swift with:</p>
  
  <pre><code>var myArray = [Int](count: 5, repeatedValue: 0)
  </code></pre>
  
  <p>But is there a way to create an array with incremented values such as <code>[0, 1, 2, 3, 4]</code> other than to do a loop such as</p>
  
  <pre><code>var myArray = [Int]()
  for i in 0 ... 4 {
      myArray.append(i)
  }
  </code></pre>
  
  <p>I know that code is pretty straightforward, readable, and bulletproof, but it <em>feels</em> like I should be able pass some function in some way to the array as it's created to provided the incremented values. It might not be worth the cost in readability or computationally more efficient, but I'm curious nonetheless.</p>