Getting values from nullable types in Swift
Forums:
let n1: Int? = 42
let value1 = n1!
//value1 is 42, Int
let n2: Int! = 37
let value2: Int = n2
//value2 is 37, Int
let nCharA: Character? = "A"
if let charA = nCharA {
//charA is "A", Character
print("\(charA)");
}
- Log in to post comments