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 trialBrendan McCarthy
2,854 PointsTotally stuck on this one...
This is challenge task 2 of 3 on the tuples portion of Swift Functions and Operationals. Honestly, what I did during the tutorial doesn't resemble what I think I need to do in this challange. I'm just looking for a little guidance. Thanks!
func greeting(#person: String) -> (greeting:String, language:String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
2 Answers
Hayes McCardell II
643 PointsSet the type of the tuple, then call the function:
var result: (greeting: String, language: String) result = greeting(person: "Tom")
stefan CHOQUETTE
1,811 PointsI've found that you need to space out your " : " or else you get errors in Treehouse. So...
(#person : string) -> (greeting : string, language : string)