Categories
|
Test: Swift - Forced Unwrapping of Optionals 2. How do you add two variables called score1 and score2 which are of type Optional
Results Congratulations! Correct Answer. You Answered: None. If you took the test, your answer will show up here. Correct Answer: score1!+score2! Explanation Here score1 is declared as: var score1: Int? and score2 is declared as score2: Int?. In order to add them, we need to first get the Int values by unwrapping them. So, adding them would be: score1!+score2!Take the Test Take 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
Test is Based on this Article
This article talks about getting the value wrapped inside an optional by unwrapping it forcibly.
|
Test on Forced Unwrapping of the Optionals in Swift.
|
|
More Articles With Similar Tags
|
This article talks about unwrapping the optionals in Swift implicitly and the circumstances where you would use this functionality.
|
Test on how and when optionals are implicitly unwrapped in Swift.
|
Test on Forced Unwrapping of the Optionals in Swift.
|
This article discusses the safer ways of unwrapping an optional in Swift that includes Optional Binding.
|
This article talks about the Nil Coalescing Operator (??) in Swift.
|
|
|
|
|