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 Tuples

Rafael Quintero
Rafael Quintero
9,935 Points

I don't think I'm missing anything in the code, and it is still marking it wrong.

I copy pasted the code into Xcode and called the function with a person's name and it keeps telling me that the name is an unresolved identifier.

tuples.swift
func greeting(person: String) -> (String, String) {
    let language = "English"
    let greeting = "Hello \(person)"

    return (greeting, language)
}

1 Answer

Looks like you're missing the last bit about naming the items in the tuple.

Rafael Quintero
Rafael Quintero
9,935 Points

Thank you, but what do you mean by that?

A named tuple is in the form

  (name: value)

To use them as a return value you'll also need to modify your function definition to reference the names. For more information check out our blog post about tuples in swift.