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 trialAlex Candelario
1,121 PointsI am getting an error I just don't understand
This is the code I am using
func greeting (#person: String) -> (greeting: String,language: String) { let language = "English" let greeting = "Hello (person)"
return greeting
}
func greeting (#person: String) -> (greeting: String,language: String) {
let language = "English"
let greeting = "Hello \(person)"
return greeting
}
1 Answer
Jhoan Arango
14,575 PointsHello Alex:
You are doing great, so far you are only missing to properly return on the tuple.
Since you created a tuple as a return type, you want to be able to βReturnβ the values in the tuple.
// Tuple as a return type
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting,language) // Returning the values from the tuple
}
Hope this helps, please let me know if you need more help.
Alex Candelario
1,121 PointsAlex Candelario
1,121 PointsThank you!