<分区>
如何比较两个 Int 值?所以,我有这个:
let limit: Int?
let current: Int = Int(self.stringValue)!
但是当我尝试比较它们时(大于或等于):
if (current >= self.limit) {
value = amount
} else {
value = current * 10 + amount
if value > self.max! {
value = amount
}
}
我得到错误:
Binary operator '>=' cannot be applied to operands of type 'Int' and 'Int?'
有什么办法解决这个问题?