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 trialRyan Anderson
4,610 PointsCan someone show me what I'm doing wrong here? Thanks
.
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
var result = greeting("Tom") {
println language
}
2 Answers
Girri M Palaniyapan
7,829 PointsIt is quite straight forward. Your function's name (Greeting) is the same as the variable in your function.
Erico Souza Mendes
3,732 PointsActually, I think you're forgetting to put the () on the println function and to call the value of the tuple I used the name of the Var that are receiving the function . the name of the tuple
Obs: there's no need to use "{}" after you create the var.
Something like:
func greeting(person: String) -> (greeting: String, language: String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
var result = greeting("Tom")
println (result.language)