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

Abdurahman Sharif
Abdurahman Sharif
1,205 Points

why is this not the right answer?

i'm supposed to simply call the function with the name Jerry. this seems so easy but i cant get why i'm not doing it correct?

named_parameters.swift
func greeting(#person: String) {
    println("Hello \(person)")
}
greeting("Jerry")
Abdurahman Sharif
Abdurahman Sharif
1,205 Points

omg, im so dumb.i got it to work. sorry for posting this question.

all i had to write was

greeting(person: "Jerry")

for anyone else who gets stuck on this challenge

1 Answer

Luke Buśk
Luke Buśk
21,598 Points

I have no idea about Swift, only was reading about it during lunch breaks when i was bored but i believe that if you provide an external parameter name for a parameter (in this case Person), then that external name should be used while calling the function:

greeting(person: "Jerry")

Abdurahman Sharif
Abdurahman Sharif
1,205 Points

yes thats exactly what i was missing. thanks Luke!!

Luke Buśk
Luke Buśk
21,598 Points

Then im glad, happy coding!