What does “String? = nil” mean here?

init(name: String, prefix: String? = nil) {

  self.name = name

  self.prefix = prefix

}

 

This initializer has 2 parameters, one is called name which takes String values, and I’m a little confused by the other one. What does String? = nil mean? the prefix parameter takes an optional String that equals nil ? Doesn’t make any sense to me, can someone explain what it means?

Powered by WPeMatico

About

You may also like...

Comments are closed.