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

I keep getting an error message saying that the code couldn't be compiled even though it runs fine on Xcode

Whenever I try to run it, it doesn't work even though I quadruple checked the code, and even tried to run it on Xcode. :/

2 Answers

Can you please post the code here (using the ```Markdown format)?

This his how it runs in Xcode

This is what it says in the website...

And This is the code, Thank you

func greeting(person: String) {
    println("Hello, \(person)!")
}
greeting("Tom")

I don't remember that challenge. Is it the "Named Parameters" one?

Try writing it in the Treehouse console like this:

func greeting(#person: String) {
    println("Hello \(person)")}

greeting(person: "Tom")

Oh, sorry, Heres the link: https://teamtreehouse.com/library/functions-and-optionals/functions/function-return-types-2

Also, the output has the same error message