var someString: String? = "a"
someString = "b"
// or someString = nil
Condition: someString is not nil and "a"
Example:
if someString != nil && someString != "a" {
}
Is it possible to condition a single?
The correct way in Swift 3 is to use a multi-clause condition:
if let bString = someString, bString != "a" {
print("bString: '\(bString)' is not nil and is different from 'a'")
}
https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With