var optionalInteger: Int?
// 方式一
// if let optionalInteger = optionalInteger {
// print(optionalInteger)
// return
// } else{
// print("no value");
// }
// 方式二 可选绑定
optionalInteger = 42
guard let optional = optionalInteger else {
print("No Value")
return
}
print(optional)
swift 可选绑定
最新推荐文章于 2022-12-17 10:56:28 发布