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

Sebastian Dizon
Sebastian Dizon
529 Points

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

Nicklas Lind
Nicklas Lind
3,619 Points

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

Sebastian Dizon
Sebastian Dizon
529 Points

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")
Nicklas Lind
Nicklas Lind
3,619 Points

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")