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 trialSebastian Nitu
8,616 PointsNeeds some help with the Tuples challenge :)
Hello,
Can you please help me with an explanation related to what I am doing wrong here:
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (language, greeting)
}
var result = greeting("Tom")
I keep getting the error: Bummer! Your result
variable has the wrong value in it. Check the task instructions again. even though the request is
"Create a variable named result and assign it the tuple returned from function greeting. (Note: pass the string "Tom" to the greeting function.)"
2 Answers
Sebastian Nitu
8,616 PointsThanks Tunde Adegoroye you were right!
Amit Bijlani is there any particular reason this is happening?
Tunde Adegoroye
20,597 PointsThe sentence should print Hello Tom English but if you put the parameters the other way around it will be english hello tom it depends on how you want to string to print but the code challenge has strict conditions
Ricardo Hill-Henry
38,442 PointsThe only thing I can see is that you've switched up your parameter names. So instead of result.greeting being set to "Tom", you have result.language set to "Tom."
Tunde Adegoroye
20,597 PointsTunde Adegoroye
20,597 PointsYou have to switch language and greeting i think because it asks for greeting and language in that order
return (greeting, language)