Categories
|
Test: Swift - Summary of ?, !, and ?? in Optionals 4. Which of the following is implicitly unwrapping the optional?
Results Congratulations! Correct Answer. You Answered: None. If you took the test, your answer will show up here. Correct Answer: var id: String! Explanation In the above options, nameLabel is an optional, because there is a ? at the end of the type - UILabel?. However, it is not being implicitly unwrapped. The variable id is being implicitly unwrapped, because there is ! at the end of String. When you use id, it will return a String value, not a String? value.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 4 of 5
Test is Based on this Article
Summary of three operators (?, !, ??) used in optionals in Swift.
|
Tags:
Test on the usage of various Optionals operators (?, !, ??) in Swift
|
|
More Articles With Similar Tags
|
This article discusses the safer ways of unwrapping an optional in Swift that includes Optional Binding.
|
Test on using Optional Binding in Swift.
|
This article talks about unwrapping the optionals in Swift implicitly and the circumstances where you would use this functionality.
|
This article talks about the Nil Coalescing Operator (??) in Swift.
|
This article talks about optional chaining in swift where multiple optionals can be chained together and fail gracefully by returning nil when one of them is nil.
|
|
|
|
|