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 trialjoshuawalliy
1,131 PointsStill not working.
Error says: swift_lint.swift:11:9: error: missing argument for parameter 'person' in call greeting() ^
func greeting(#person: String) { // remove the '#'
println("Hello \(person)")
}
greeting()
3 Answers
Richard Lu
20,185 PointsHi Joshua,
I noticed that you looked at my answer to your previous post which was "How would I Call the greeting function and pass it the String Jerry". If you wanted to call the greeting function and pass it the string "Jerry", then you'd have to pass it to the function when you call it, like this:
greeting("Jerry") // passing in "Jerry"
If you wanted to call greeting without any parameters (which doesn't make sense), then you'd have to define a default value which you'll learn later on in the course.
Good luck! :)
Daniel H
1,479 PointsThis still does not work
Richard Lu
20,185 PointsHey Daniel,
Do you mind giving me the error you're getting. Is it the same one or different?
If the error is due to running this on playground, Apple has changed this as of Swift 2.0+. The alternative to this solution would be:
func greeting(person person: String) {
print("Hello \(person)")
}
greeting(person: "Jerry")
- Rich
Daniel H
1,479 PointsIt's says: Bummer! You need to call greeting()
lol.