的代码如下所示:为什么Int(false)工作但Int(booleanVariable)不?
Int(false) // = 1, it's okay
//but when I try this
let emptyString = true //or let emptyString : Bool = true
Int(emptyString) //error - Cannot invoke initializer with an argument list of type '(Bool)'
任何人都可以解释这个事实?这很混乱。里面会发生什么?
这是不允许在迅速3. – Dili
我不认为它是重复的,问题是“为什么”,而不是“如何”。问题的标题应该被编辑。 –