Fatal error: Unpacking an empty Optional value.
Wrapping: Use an exclamation point after Optional. Such as “value!”
Error code:
Wrapping: Use an exclamation point after Optional. Such as “value!”
Error code:
let testString =”lalala”
Let a = testString. ToInt ();
Println (” \ (a! “)
You cannot unpackage an empty Optional, otherwise a runtime error will be reported. Therefore, it should be determined whether it is null before unpacking Optional.
Correct writing:
let testString =”lalala”
Let a = testString. ToInt ();
If (a! = nil) {
Println (” \ (a! “)
}