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 trialSubhaan Akhter
Courses Plus Student 513 Pointsneed 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
26,676 PointsHi 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.
ankushdharkar
7,530 PointsDid 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)")
}
Subhaan Akhter
Courses Plus Student 513 PointsSorry posted wrong code this is what I wrote
func greeting(person: String) {
println("Hello (person)")
} greeting("Tom")
Subhaan Akhter
Courses Plus Student 513 Pointsmy output is "hello tom" and not hello tom
ankushdharkar
7,530 PointsDid you put the '\' ?
(person) ?
ankushdharkar
7,530 PointsCopy paste my code and see if that works
Subhaan Akhter
Courses Plus Student 513 PointsRight yeh thanks guys it seems many others have been experiencing problems with this question