Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Marco Garduño
1,549 Pointshelp , I think I am right but system says I´m wrong
help
func greeting(person: String) {
println("Hello \(person)")
}
greeting("Tom")
2 Answers

jcorum
71,816 PointsFirst, you need to add a return type, and second, you need to turn the print statement into a return statement:
func greeting(person: String) -> String {
return "Hello \(person)"
}

jcorum
71,816 PointsP.S., you weren't asked to call the function, but you did, and did it correctly. Usually, though, you would want to do something with the return value. E.g., store it in a variable or constant, or display it:
let msg = greeting("Tom")
print(greeting("Tom"))