How is optional binding used in swift?

前端 未结 9 2725
太阳男子
太阳男子 2020-12-10 13:07

In swift the following syntax is allowed for flow control

if let constantName = someOptional {
    statements
}

In this context wh

9条回答
  •  误落风尘
    2020-12-10 13:24

    In Swift 1.2 and 2.1, you can do this:

    if let constantName = someOptional, constantName2 = someOptional2 {
        // statements
    }
    

提交回复
热议问题