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 trialDwight Tarrago
699 PointsMy friends I am having trouble completing this one. More than likely I don't quite get what is actually asking me.
Ok I think I know what is asking me but I feel I am not doing what is asking me. On Xcode 7 works as I belief as intended but I don't know.
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (language, greeting)
}
var result = greeting("Tom")
2 Answers
Cindy Lea
Courses Plus Student 6,497 PointsWhen you call the greeting function you are using only 1 variable. The challenge wants a tuple. You have 2 variables in the function, but you dont pass 2 values when you call function.
Brian Steele
23,060 PointsWeird deal, everything looks pretty good above, I got the challenge to both pass AND fail with the code below. Looks like you've correctly defined the expected return value correctly and returned the correct values in the function. Refresh and try again :)
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
var result = greeting("Tom")