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

Jaron Trotter
Jaron Trotter
11,472 Points

Call the greeting function and pass it the string "Jerry". I'm just not sure what they want me to do.

Definitely over thinking it.

named_parameters.swift
func greeting(person: String) {
    println("Hello \(person)")
}

func greeting(#person: String) {


}

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Here you're redefining your function or rewriting your function. This isn't necessary. The challenge wants you to "call" (invoke/run/execute) the bit of code inside that function. And it wants you to specifically send it the name "Jerry". But outside of the challenge you could send any string you like. You could send "The Artist formerly known as Prince"! Here's my code. Hope it helps!

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

greeting(person: "Jerry")
Jaron Trotter
Jaron Trotter
11,472 Points

Your amazing! Thank you for the help.

I can't wait till I can return the favors and help the newbie