Answers

Question and Answer:

  Home  Swift Developer

⟩ Explain me what Is The Significance Of “?” In Swift?

The question mark (?) is used during the declaration of a property. If the property does not hold a value, the question mark (?) helps to avoiding application errors.

Example looks like -

class Employee {

var certificate : [Certificates]?

}

let employee = Employee();

Example 2 -

let middleName : String? = nil

let lastName : String = "Muhammad"

let name : String = middleName ?? lastName

 202 views

More Questions for you: