swift学习笔记--swift3.0 if-let、guard语句中的where的替换

来源:互联网 发布:linux递归创建目录 编辑:程序博客网 时间:2024/06/06 02:19

在swift3.0中,if-letguard语句中的where都用“,”替代了。

let oAge: Int? = 20if let age = oAge , age>18 {    print(age)}func guardTest(){    let bAge:Int? = 30    guard let age = bAge , age > 18 else {    print("年龄小于18岁")    return}    print(age)}var aa: Int?? = 20guardTest()


1 0