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 trialHarold Davis
Courses Plus Student 14,604 PointsNot sure how to change this function so it returns multiple values...
[Problem]Currently our greeting function only returns a single value. Modify it to return both the greeting and the language as a tuple. Make sure to name each item in the tuple: greeting and language. We will print them out in the next task.
I don't see how to get it to return this is the first assignment i've gotten stuck on. I under stand that you can have multiple return types but I don't get how to solve this one.
func greeting(person: String) -> String {
let language = "English"
let greeting = "Hello \(person)"
return greeting
}
1 Answer
Chris Shaw
26,676 PointsHi Harold,
Have a read of my answer to the below post as I explain in some detail what tuples are and what the challenge is looking for.
Happy coding!
Harold Davis
Courses Plus Student 14,604 PointsHarold Davis
Courses Plus Student 14,604 PointsThank you so much buddy Thanks for not just giving me the answer but teaching me how to fish LOL that was awesome I appreciate it man.
Happy coding!