class ViewController: UIViewController {
@IBOutlet weak var display: UILabel?
var userIsInTheMiddleOfTyping = false
@IBAction func touchDigit(sender: UIButton) {
let digit = sender.currentTitle!
let textCurrentlyInDisplay = display!.text!
display!.text = textCurrentlyInDisplay + digit
Stanford Swift计算器课程最后display!.text
没有解释。我理解之前的let textCurrentlyInDisplay = display!.text!
,但为什么作业左侧的display
必须有感叹号?