Skip to content

Instantly share code, notes, and snippets.

@agoiabel
Created January 13, 2018 08:36
Show Gist options
  • Save agoiabel/2a52eba3bffde9f79a8c9559c5d3cdbe to your computer and use it in GitHub Desktop.
Save agoiabel/2a52eba3bffde9f79a8c9559c5d3cdbe to your computer and use it in GitHub Desktop.
Person {
var firstname: String
var middlename: String?
var lastname: String
func fullName() -> () {
print("Your fullname is \(firstname) \(middlename!) \(lastname)")
}
}
let anotherPerson = Person(firstname: "Abel", middlename: nil, lastname: "Adeyemi")
anotherPerson.fullName() //This will throw a runtime error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment