Test: Swift - Implicit Unwrapping of Optionals
2. var score: Int!; score = score + 10 - what happens?
Congratulations! Correct Answer.
You Answered: None. If you took the test, your answer will show up here.
Correct Answer: Crash - nil found after unwrapping
ExplanationThe score variable is implicitly unwrapped. But it has never been initialized to a proper integer value. That means it will have a nil value. So, there will be a crash (fatal error) when the system finds nil after unwrapping an optional.
Take the TestTake the complete test on this topic. You will be able to review answers to questions and get a test score.
Take the Test
Question 2 of 5