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 trialArtem Zverkovskiy
1,090 PointsParameters and Tuples
I don't understand exactly what should do. I suppose, I did everything but it doesn't work. Please tell me where are my mistakes?
func greeting(language: String, greeting: String) -> String {
let language = "English"
let greeting = "Hello"
return greeting
}
2 Answers
Chris Shaw
26,676 PointsHi Artem,
You have the general gist of what's been asked but have your code in the wrong spot and are missing the correct return type, so as you can see below the following has changed.
- The tuple is where the return type
String
was - The
return
value within thegreeting
function now returns a tuple containing thegreeting
andlanguage
constants.
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
Happy coding!
Ramon Trinidad
748 PointsThank you. I was stuck here too. Practice practice practice...
Artem Zverkovskiy
1,090 PointsArtem Zverkovskiy
1,090 PointsOh! I see. It's so clear! Thanks!
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsNo worries.