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 trial

iOS Swift Functions and Optionals Parameters and Tuples Named Parameters

Jake N
Jake N
612 Points

videos and challenges

I'm confused on how the videos and challenges go together. i keep watching the videos and after try and complete the challenge. ill go back to the previous video but am still unable to figure out the answers

named_parameters.swift
func greeting(person: String) {
    return #person")
}

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Jake,

The code given within the body of the function doesn't need to be changed, all task 1 is asking for is to change person to a named parameter which is as simple as prefixing person with a hash/pound symbol like below.

func greeting(#person: String) {
  println("Hello \(person)")
}

Happy coding!

Jake N
Jake N
612 Points

dang, i may have to go back and review all the videos