title: Reason for assigning optional to new variable in conditional statement in Swift
body: <p>I'm going through the swift docs, and in the optional segment, it talks about using the question mark -- <code>?</code> -- to signify variables that might be nil.  This can be used in an if statement to check for nil, but in the docs they assign the optional to a new variable in the conditional.  Is there a reason for this?</p>
  
  <p>For Example, it is presented in <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-XID_1">the docs</a> similar to this:</p>
  
  <pre><code>// Declare an optional string (might be nil)
  var optionalString: String? = "Hello"
  
  // Assigns optionalString to new variable before checking if nil
  if let string = optionalString {
      println("\(optionalString) is not nil!")
  }
  else {
      println("\(optionalString) is nil")
  }
  </code></pre>
  
  <p>However, this runs just fine for me in tests:</p>
  
  <pre><code>var optionalString: String? = "Hello"
  
  // Assigns optionalString to new variable before checking if nil
  if optionalString {
      println("\(optionalString) is not nil!")
  }
  else {
      println("\(optionalString) is nil")
  }
  </code></pre>
  
  <h3> Question </h3>
  
  <p>Is there a reason to assign <code>optionalString</code> to a new variable <code>string</code> in the conditional statement?</p>