title: Constant unassigned optional will not be nil by default
body: <p><strong>My understanding so far</strong> : If you define an optional variable without assign any values, the compiler will automatically assign the <code>nil</code></p>
  
  <p><strong><em>Code Snippets:</em></strong> </p>
  
  <p><strong><em>A :</em></strong></p>
  
  <pre><code>var someOptional : Int? //Change to `let` to trigger error 
  var aDefaultValue = 42
  var theAnswer = someOptional ?? aDefaultValue
  </code></pre>
  
  <p>The code snippet above works fine, however, when I changed the variable <code>someOptional</code> to a constant, the compiler yelled an error (Please see the attached figure below)</p>
  
  <p><a href="https://i.stack.imgur.com/iZtpl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iZtpl.png" alt="enter image description here"></a></p>
  
  <p><strong><em>B :</em></strong></p>
  
  <p>I then tried the similar codes to down to the problem. </p>
  
  <pre><code>var someOptional : Int?
  print(someOptional)
  </code></pre>
  
  <p>Still, it works fine with variable while failed with the constant type.  </p>
  
  <p><a href="https://i.stack.imgur.com/ZcDHp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZcDHp.png" alt="enter image description here"></a></p>
  
  <p><strong>Conclusion:</strong></p>
  
  <p>If you define a constant optional you have to assign the nil explicitly if you mean that. Because it looks useless (why do you need a constant option with assigned with <code>nil</code>), if the compiler did that for you automatically it may introduce an error.  </p>
  
  <p><strong>Question:</strong> </p>
  
  <p>Why does the compiler assume <code>nil</code> for <code>var</code> declared optionals but not for <code>let</code> declared optionals?</p>