title: Swift closure capture and inout variables
body: <p>Consider the following code:</p>
  
  <pre><code>func foo(inout success: Bool) -&gt; (()-&gt;()) {
      return { _ in
          success = true
          print (success)
      }
  }
  
  var success = false
  let closure = foo(&amp;success)
  
  closure()          //prints "true"
  print(success)     //prints "false"
  </code></pre>
  
  <p>The closure appears to be creating a copy of success and does not change the original. Why is this taking place? I had assumed that the closure would point to the original because we are passing an <code>inout</code> variable.</p>