@IBAction func blueBtnAct(_ sender: AnyObject) {
score++ //error bcause Unary operator '++' cannot be applied to an operand of type '@lvalue Int'
blueLbl.text = "\(score)"
GrenLbl.text = "\(score)"
testScore()
}
@IBAction func GrenBtnAct(_ sender: AnyObject) {
score-- //error bcause Unary operator '--' cannot be applied to an operand of type '@lvalue Int'
blueLbl.text = "\(score)"
GrenLbl.text = "\(score)"
testScore()
}
答案 0 :(得分:6)
您应该使用score = score + 1
代替score++