Swift
Why optionals exist
Why does Swift have optionals?
How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
Why does Swift have optionals?
An optional puts 'this may have no value' into the type so the compiler can force you to handle nil.
SwiftMultiple choiceIntro
Which of these three lines compile? Pick all that apply. …
#optional #nil
SwiftShort answerBasics
Extend Optional so that any optional can be asked for its nil status, like…
#optional #enum
SwiftShort answerAdvanced
Suppose there were no question-mark optional syntax and no standard Optional. If you had…
#optional #enum
SwiftMultiple choiceIntro
Which of these unwrap an optional safely? Pick all that apply.
#optional