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.

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,662 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