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 trialeaston breinholt
1,360 Pointsfunc greeting(#person: String) { println("Hello \(person)") } greeting( person: "Jerry")
What am I doing wrong?
func greeting(#person: String) {
println("Hello \(person)")
}
greeting( person: "Jerry")
1 Answer
Chris Shaw
26,676 PointsHi easton breinholt,
You're code is almost correct, however you have a couple of extras/differences that the challenge isn't expecting.
You've defined
person
as a named parameter which it doesn't need to be, in this case you can omit the hash/pound#
and removeperson:
from yourgreeting
function callYou have passed Jerry as the string to
greeting
, instead this should be Tom as per the task.
func greeting(person: String) {
println("Hello \(person)")
}
greeting("Tom")
Happy coding!
easton breinholt
1,360 PointsThank you.
Karl Avila
Courses Plus Student 512 PointsKarl Avila
Courses Plus Student 512 PointsI've learned that with these challenges you need to read it carefully. After the video lesson, I would read it and type out the whole lesson and wonder what I did wrong. Most of the time it was because I was providing too much information, which seems to be your case as well. Look at the challenges, if it has 1 of 3 or something like that, don't overthink your coding. Good luck!