Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLuis Cunha
2,720 PointsI'm sure the code is correct, and yet the grader does not accept it.
...
func greeting(person: String) -> (String, String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
3 Answers
Jhoan Arango
14,575 PointsYou are forgetting to name your tuple parameters..
Enrique Munguía
14,311 PointsYou must specify the names of the parameters in the return type
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
This is a requirement when you return tuples.
Luis Cunha
2,720 PointsThanks. I don't think it is a requirement though (besides this exercise). This is acceptable in xcode:
func greeting(person: String) -> (String, String) { let language = "English" let greeting = "Hello (person)" return (greeting, language) }
Luis Cunha
2,720 PointsThank you. Indeed I did not fully read the question.
Enrique Munguía
14,311 PointsHelp other students reading this question upvoting and marking the best answer.