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 trialJulian Mazza
1,511 PointsI copy and pasted my code into xcode, and it worked. For some reason, it's not working on treehouse.
It really should work.
func greeting(person: String) -> (String, String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting,language)
}
4 Answers
Andrew Claytor
6,637 PointsYou have it really close. Just name the tuples
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (language, greeting)
}
Steve Hunter
57,712 PointsI amended your answers to format the code a little more clearly. If you use the backtick ` rather than the single quote, it will work.
Three backticks before the code, followed immediately by the language name (or filename with extension), then three backticks after the code. If you edit your post you'll see what I mean.
Steve.
Steve Hunter
57,712 PointsThat was for Andrew, not Julian! :-)
Andrew Claytor
6,637 PointsThank you very much! I was trying to figure out how to get the code looking good.
Steve Hunter
57,712 PointsNo problem! :-)
Andrew Claytor
6,637 Pointsfunc greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"
return (language, greeting)
}
Julian Mazza
1,511 PointsThanks a lot guys!