按照书本写了以下代码,但貌似因为所用swift版本(我的环境是Xcode7.3)不同导致了一点语法错误,没有想到头绪……let simpleInterestCalculationClosure = { (loadAmmon : Double, var interestRate : Double, years : Int) -> Double in
//警告1:'var' parameters are deprecated and will be remove in swift 3 fix-it Delete "var"
interestRate = interestRate / 100.0
//错误2: Cannot assign to value: 'interestRate' is a 'let' constant
var interest = Double(years) * interestRate * loadAmmon
return loadAmmon + interest
}但是删除了var之后会出现错误2
- 2 回答
- 0 关注
- 1261 浏览
添加回答
举报
0/150
提交
取消