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 trialCarlos Loeza
1,139 PointsWhat am I doing wrong? It has no compiler errors but it still doesn't allow me to advance
Help
func greeting(person: String) -> (language: String, greeting: String) {
let language = ("English", "Hello \(person)")
return language
}
var result = greeting("Tom")
1 Answer
Stepan Ulyanin
11,318 PointsHi, you are returning only one value not 2 as a tuple, you need to specify the tuple at your return statement:
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (language, greeting)
}
var result = greeting("Tom")
Enrique Munguía
14,311 PointsEnrique Munguía
14,311 PointsMaybe the exercise expects that you define two variables and return them as a tuple.