0
When we must use \ in return in SWIFT example below:
func sayHello(personName: String, personAge: Int) -> (greeting: String, age: Int) { return ("Hello, \(personName)", personAge) } FOR personName WE USE \ AND BRACKETS WHY NOT FOR personAge?? Whole code: func sayHello(personName: String, personAge: Int) -> (greeting: String, age: Int) { return ("Hello, \(personName)", (personAge)) } let hello = sayHello(personName: "Bill", personAge: 5) print("\(hello.greeting) (age: \(hello.age))")
2 Answers