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 trial
Shaun Maclellan
1,364 PointsNaming Parameters and Tuples Challenge Issue
func greeting(#person: String) { println("Hello (person)") }
Call the greeting function and pass it the String "Jerry"?
I have tried adding in greeting(person:"Jerry")
4 Answers
Stone Preston
42,016 Pointsmake sure you are calling the function outside of the function itself. also you are missing the slash for interpolation:
func greeting(#person: String) {
//add the slash for interpolation
println("Hello \(person)")
}
greeting(person: "Jerry")
Shaun Maclellan
1,364 PointsIt works thanks!
Shaun Maclellan
1,364 PointsCreate a variable named result and assign it the tuple returned from function greeting. (Note: pass the string "Tom" to the greeting function.):
func greeting(person: String) -> (language: String, greeting: String, person: String) { let language = "English" let greeting = "Hello (person)" let person = "Tom"
var result = greeting(person: greeting)
return result
}
I am not sure what I am doing in this one either?
Thomas Jernbro
4,459 PointsHi Shaun,
The Code should be:
func greeting(person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)
return (language, greeting)
}
var result = greeting("Tom") //You pass the string Tom when calling the greeting function.