title: Swift infinite loop in viewDidLoad
body: <p>I am having trouble figuring out what's going on in this simple app.  I created a basic Single View Application, added this function to the ViewController.swift:</p>
  
  <pre><code>func add() -&gt; Double {
      var a = 0.0
      for var i = 0; i &lt; 2; i++ {
          a = 1.0
      }
      return a
  }
  </code></pre>
  
  <p>Here is my ViewController's viewDidLoad:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      var test = add()
  }
  </code></pre>
  
  <p>If I put a breakpoint on the <code>return a</code> line, set it to continue after evaluating and print the breakpoint's hit count to the log then I can see that it just keeps going up and the view never loads.  What am I missing?</p>