Skip to content

Instantly share code, notes, and snippets.

@hanawat
Created January 16, 2016 20:06
Show Gist options
  • Save hanawat/741df51519cb75e5008d to your computer and use it in GitHub Desktop.
Save hanawat/741df51519cb75e5008d to your computer and use it in GitHub Desktop.
Overload is possible using the same method name.
func user(name: String, hobby: String) {
print("My name is \(name). I like \(hobby).")
}
func user(name: String, hobby: String, greeting: String) {
print("My name is \(name). I like \(hobby). \(greeting).")
}
user("Bob", hobby: "Football")
user("Mary", hobby: "Cook", greeting: "Nice to meet you")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment