13 lines
315 B
Swift
13 lines
315 B
Swift
// Default parameters
|
|
// https://www.hackingwithswift.com/sixty/5/6/default-parameters
|
|
|
|
func greet(_ person: String, nicely: Bool = true) {
|
|
if nicely == true {
|
|
print("Hello, \(person)!")
|
|
} else {
|
|
print("Oh no, it's \(person) again...")
|
|
}
|
|
}
|
|
|
|
greet("Taylor")
|
|
greet("Taylor", nicely: false) |