Swift - Optionals
Consider this code snippet:
What is the problem and how to fix it?
var age: Int? = nil print(age!)
What is the problem and how to fix it?
var age: Int? = nil print(age!)
age! when age is nil causes a runtime crash.if let or guard let to safely unwrap before printing.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions