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))")

28th Nov 2020, 5:11 PM
Dzondzula
Dzondzula - avatar
2 Antworten
0
C-MOON thank you i read somewhere its similar to PYTHON and paython is same as python when you have bad grammar and 0 knowledge of python😂
29th Nov 2020, 5:19 PM
Dzondzula
Dzondzula - avatar