Optional Binding
let maybeNumber: Int? = 1
if let number = maybeNumber {
// This branch is executed as `maybeNumber` is not `nil`.
// The constant `number` is `1` and has type `Int`.
} else {
// This branch is *not* executed as `maybeNumber` is not `nil`
}let noNumber: Int? = nil
if let number = noNumber {
// This branch is *not* executed as `noNumber` is `nil`.
} else {
// This branch is executed as `noNumber` is `nil`.
// The constant `number` is *not* available.
}Last updated