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 trialant
2,273 PointsTuples objectives
is the following correct?
func greeting(person: String) -> (String,String) { var language = "English" var greeting = ("Hello (person)") var tuple = (language,greeting) return tuple }
It wouldnt accept it here but Xcode does..
1 Answer
krilnon
1,458 PointsThe task wants you to name the elements of the tuple you return. As your code is right now, the tuple you return would just have index-based element names, like .1
and .2
.
You correctly adjusted the return type to (String, String)
, but you can give each of those tuple elements names. For example:
func wholeNameToLastName(name:String) -> (firstName:String, lastName:String) {
// break name into parts here
return (firstName, lastName)
}
So you just need to do something similar for your specific task.
ant
2,273 Pointsant
2,273 PointsThanks krilnon! So i guess the destination is the same the journey changes a bit.. :)