title: map function in Swift converting String to Int?
body: <pre><code>let digitNames = [
      0: "Zero", 1: "One", 2: "Two",   3: "Three", 4: "Four",
      5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine"
  ]
  let numbers = [16, 58, 510]
  
  let strings = numbers.map {
      (var number) -&gt; String in
      var output = ""
      while number &gt; 0 {
          output = digitNames[number % 10]! + output
          number /= 10
      }
      return output
  }
  // strings is inferred to be of type [String]
  // its value is ["OneSix", "FiveEight", "FiveOneZero"]
  </code></pre>
  
  <p>I was hoping if there is anyone that could explain how this code works (it is taken from apple's developer page for swift under "closures). I'm not too sure especially what the code in the "while" loop means :/ how exactly is the number converted to string?</p>