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 trialbasmah Almashari
1,521 PointsERROR: the 'result' variable has a wrong value in it
hello i tried to figure out what the wrong in this code but still give me an error
```swift func greeting (person: String) ->(greeting: String , language: String){ return ("English","Hello (person)") } var result = greeting("Tom")
```tuples.swift
func greeting (person: String) ->(greeting: String , language: String){
return ("English","Hello \(person)")
}
var result = greeting("Tom")
2 Answers
Steve Hunter
57,712 PointsHi there,
You're nearly there. You nee to amend the return value (after the ->) to return two named strings. Then amend the return
statement to do the same. You end up with:
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
Hope that helps.
Steve.
basmah Almashari
1,521 Pointsthank you Steve, it works that way
Steve Hunter
57,712 PointsNo problem. Glad to help! :-)