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 Swift Functions and Optionals Parameters and Tuples Named Parameters

Still 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)")


3 Answers

Richard Lu
Richard Lu
20,185 Points

Hi 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! :)

This still does not work

Richard Lu
Richard Lu
20,185 Points

Hey 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

It's says: Bummer! You need to call greeting() lol.