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

iOS Swift Functions and Optionals Functions Function Return Types

Mark Weiser
Mark Weiser
2,093 Points

Cannot come up with this one after countless tweaks...

I thought this one would be a piece of cake. This is the code that I initially put and I feel it's the most minimal and effective of my tries.

Please & Thanks!

returns.swift
func greeting(person: String) -> String {
    return person
}

println("Hello \(greeting))")

1 Answer

Vivek Dhar
Vivek Dhar
2,073 Points
func greeting(person: String) -> String {
    return "Hello \(person)"
}
greeting("Mark")
Mark Weiser
Mark Weiser
2,093 Points

Thank you Vivek! After seeing your correction it's pretty clear what I was doing wrong.