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 trialboris said
3,607 PointsI get this error when I try to run my code and i've tried many different things and I can't get it to work please help.
Can someone please help me
func greeting(person: String)-> String {
let language = "English"
let greeting = ("Hello \(person)",language)
return (greeting, language)
}
var (greeting,language) = greeting("Bob")
1 Answer
Shannon Smith
1,016 PointsTry this:
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
let both = (language, greeting)
return both
}
Jhoan Arango
14,575 PointsJhoan Arango
14,575 PointsHello Shannon:
Your answer is a good solution, however there is a more simple way to do this, and one that I think the challenge is expecting.
Again your solution is good, I am just adding an extra solution to your answer :)