guard 語句
解包之后b的作用域仍然有效
var a: String? = "lcm"
guard let b = a else { print("a is nil") }
print(b)
if 語句
解包之后b的只有在 { ... } 內(nèi)才有作用域
var a: String? = "lcm"
if let b = a { print(b) }
解包之后b的作用域仍然有效
var a: String? = "lcm"
guard let b = a else { print("a is nil") }
print(b)
解包之后b的只有在 { ... } 內(nèi)才有作用域
var a: String? = "lcm"
if let b = a { print(b) }