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 trialjuanrodriguez6
2,776 PointsWhat's wrong here? var result = greeting("Tom") //Error: Your `result` variable has the wrong value in it.
I cannot pass beyond this point. I use a playground in Xcode and it compiles find.
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (language, greeting)
}
//Your `result` variable has the wrong value in it.
var result = greeting("Tom")
1 Answer
Stone Preston
42,016 Pointstask 1 states: Make sure to name each item in the tuple: greeting and language
this challenge is quite picky and expects greeting to come first, then language
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
var result = greeting("Tom")
Amit Bijlani, any way you can modify the challenge to accept it regardless of the order of the tuple elements?
juanrodriguez6
2,776 Pointsjuanrodriguez6
2,776 PointsOh! Thanks!
Stone Preston
42,016 PointsStone Preston
42,016 Pointsno problem. glad I could help
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherThanks Stone. I'll look into it or at least add a hint.
Gareth Gomersall
2,890 PointsGareth Gomersall
2,890 PointsYeah this was a bit confusing to be honest....... why does it expect greeting to come first?