我刚开始用斯坦福教程学习Swift.我有Xcode 6.3.2.我在操作中遇到了一个错误,switch无法理解如何解决它.
我也附了一个截图
@IBAction func operate(sender: UIButton) {
let operation = sender.currentTitle!
if userIsInTheMiddleOfTypingANumber{
enter()
}
switch operation{
case "?": performOperation {$0+$1}
case "??": performOperation {$0*$1}
case "?": performOperation {$1/$0}
case "?": performOperation {$1-$0}
default:break
}
}
private func performOperation(operation : (Double,Double)->Double){
if(operandStack.count>=2){
DisplayValue = operation(operandStack.removeLast(),operandStack.removeLast())
enter()
}
}
Run Code Online (Sandbox Code Playgroud)

您的代码看起来很好,看起来您不小心在代码中放置了一个断点,看到绿色突出显示行左侧的蓝色箭头?
执行以下操作之一:
当您执行以下列出的操作之一时,您的程序将顺利运行
别担心,您将开始关注这些简单的修复,您将能够获得更多编码.
有关添加,禁用和删除断点的详细信息,请查看此信息.
| 归档时间: |
|
| 查看次数: |
216 次 |
| 最近记录: |