title: Learning swift, Issues with incrementing variables
body: <p>I'm back again with what is likely a simple issue, however its got me stumped.</p>
  <p>I've written very small, very basic piece of code in an xcode playground.
  My code simply iterates over a function 10 times, printing the output each time.</p>
  <pre><code>var start = 0
  var x = 0
  var answer = 2 * x
  
  func spin() {
      print(answer)
  }
  while start &lt; 10 {
      spin()
      x++
      start++
  }
  </code></pre>
  <p>Now for my issue, It seems my code properly increments the 'start' variable.... running and printing 10 times. However it prints out a list of 0's. For some reason the 'x' variable isn't incrementing.</p>
  <p>I've consulted the few ebooks I have for swift, aswell as the documentation, and as far as i can see my code should work.</p>
  <p>Any ideas?</p>
  <p>P.s. As per the documentation I have also tried ++x, to no avail.</p>
  <h1>edit</h1>
  <p>Updated, working code thanks to answers below:</p>
  <pre><code>var start = 0
  var x = 0
  var answer = 2 * x
  
  func spin() {
      print(&quot;The variable is&quot;, x, &quot;and doubled it is&quot;, answer)
  }
  while start &lt;= 10 {
      spin()
      x++
      start++
      answer = 2 * x
  }
  </code></pre>