title: Why does this swift code work when newValue has nothing assigned to it?
body: <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
  @IBOutlet weak var display: UILabel!
  
  var inMid = false
  
  @IBAction func appendDigit(sender: UIButton) {
      let digit = sender.currentTitle!
      if inMid{
          display.text = display.text! + digit
      }else{
          display.text = digit
          inMid = true
      }
  }
  
  
  var operandStack = Array&lt;Double&gt;()
  @IBAction func enter() {
      inMid = false
      operandStack.append(displayValue)
      println("operandStack = \(operandStack)")
  }
  
  
  var displayValue:Double{
      get {
          return NSNumberFormatter().numberFromString(display.text!)!.doubleValue
      }
      set{
          display.text = "\(newValue)"
      }
  }
  
  }
  </code></pre>
  
  <p>This is the part of code used in the latest Standford IOS 8 course using swift to build a calculator(Youtube address: <a href="https://www.youtube.com/watch?v=QLJtT7eSykg" rel="nofollow">https://www.youtube.com/watch?v=QLJtT7eSykg</a>)</p>
  
  <p>Every time I call enter() (press enter), a new number is supposed to be saved in a stack. For example: "8, enter()" --> {8},  "16, enter()" --> {8,16}.</p>
  
  <p>I got confused about the computed property "displayValue" here. There is nothing assigned to the "newValue". If there is something like "displayValue = 8", then I know "newValue" is 8, and it all makes sense. But there is not such thing. </p>
  
  <p>How come it still works? </p>
  
  <p>(What I mean is not the name "newValue" itself,I know it is a default setting by Swift, instead, the missing of assigned value is the one that confuses me)</p>