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 trialTyler Zika
14,402 PointsWhat am I doing wrong in this Tupel exercise? The code outputs perfectly in xcode
Here is the code:
func greeting(person: String) -> (String,String) {
let language = "English"
let greet = "Hello \(person)"
return (greet, language)
}
I've watched the videos 5-6 times and I'm still not seeing what I should. They exercise wants me return the language and the greet in the tuple.
1 Answer
Stone Preston
42,016 Pointsthe task states: Make sure to name each item in the tuple: greeting and language. so you need to name the elements of the tuple in your return type
//give the tuple elements a name
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
Tyler Zika
14,402 PointsTyler Zika
14,402 PointsThanks Stone. Your answer makes complete sense! :D