<分区>
let errorCodestring : String?
if let theError = errorCodestring {
print(theError)
}
在上面的代码中,Xcode 抛出了错误:
constant 'errorCodestring'being used before being initialized
代码有什么问题,如何清除错误?
标签 swift
<分区>
let errorCodestring : String?
if let theError = errorCodestring {
print(theError)
}
在上面的代码中,Xcode 抛出了错误:
constant 'errorCodestring'being used before being initialized
代码有什么问题,如何清除错误?
最佳答案
您必须在使用常量之前对其进行初始化。
let errorCodestring : String? = nil
关于swift - 初始化前使用的常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53230836/