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 trialHunter Christian Davis
2,813 PointsI dont understand
I do not understand why we call the function greeting, then have the tuple named greeting along with the constant
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
3 Answers
Ricardo Hill-Henry
38,442 PointsThe best answer I can come up with is, it was done to confuse you and make the challenge a bit more difficult. It seems a lot of people get stuck on the fact greeting is used various time.
Actually, I guess it's fairly likely greeting and language was used in multiple places to get us to realize that though three different elements have the name "greeting", they're not connected to each other. Function names, tuple parameters (or whatever they're called), and function properties are their own entities.
Hunter Christian Davis
2,813 PointsThanks, if their goal was to confuse me, they succeeded .
justin coots
698 PointsThanks Ricardo, def not a smart move to do that with beginners, its hard enough as it is to understand the concepts...
Hunter Christian Davis
2,813 PointsHunter Christian Davis
2,813 PointsThanks, if their goal was to confuse me, they succeeded .