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 trialhamsa mussa
1,739 PointsDoesnt return name
func greeting(person: String) -> String { return "Hello" ; "(greeting(person))" } i supposed to get Hello Person name what us wrong with my code
func greeting(person: String) -> String {
return "Hello" ; "\(greeting(person))"
}
3 Answers
William Li
Courses Plus Student 26,868 PointsHello, hamsa mussa
Original code template:
func greeting(person: String) {
println("Hello \(person)")
}
Pretty much to pass this challenge, you only need to do TWO things to Modify the given code.
- change the
println
keyword toreturn
. - give this function the return type
String
.
And leave everything else untouched.
func greeting(person: String) -> String {
return "Hello \(person)"
}
Hope this helps.
hamsa mussa
1,739 PointsThank you William for your reply, This is the reply from Code Challenge Bummer! Your function isn't returning the correct value. I tried passing "Fred" as the parameter and got back "Hello", but expected "Hello Fred".
hamsa mussa
1,739 PointsThank You very much for your help. I Appreciate it.
William Li
Courses Plus Student 26,868 Pointsyou're welcome :)