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

need help with Swift Syntax and Parameters challange

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

greeting("Tom")

I don't know whats wrong :( thats my code i type in the challenge but the output comes as "hello tom" instead of hello tom

7 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Subhaan,

The quotes you see are part of the println function, when executed a string for instance is wrapped with quotes in the console output thus the value is actually what you would expect to see.

Hope that clears up any confusion.

Did you mean your output comes out as : "Hello (person)" ?

That is because you are missing the \ in the syntax. Try this :

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

Sorry posted wrong code this is what I wrote

func greeting(person: String) {

println("Hello (person)")

} greeting("Tom")

my output is "hello tom" and not hello tom

Did you put the '\' ?

(person) ?

Copy paste my code and see if that works

Right yeh thanks guys it seems many others have been experiencing problems with this question