title: Error: "Variable used within its own initial value" within closure
body: <p>Why can't I &quot;use a variable within its own initial value&quot; when I am using it in a closure which won't be called until after the variable has been initialized? And how do I avoid this error?</p>
  <p>Crude example:</p>
  <pre><code>class Action {
      var name: String
      var completion: () -&gt; Void
  
      init(_ name: String, completion: () -&gt; Void ) {
          self.name = name
          self.completion = completion
      }
  }
  
  let action = Action(&quot;Take&quot;, completion: {
      // Do something
  
      // Then...
      print(action.name) // Error: Variable used within its own initial value
  })
  </code></pre>
  <p>Another question on SO said &quot;You can use a mutable variable instead, and the closure will capture the variable rather the its value.&quot; but this doesn't make sense to me. How do I make the &quot;name&quot; parameter a mutable variable..isn't it already?</p>