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

eric robinson
eric robinson
3,016 Points

I tried to modify the -> to (String, String) and the return to return (greeting, language) and many other ways but no go

I don't thing I understand what they are asking in the challenge

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

    return (greeting, language)
}

1 Answer

Hi there,

You're pretty much there but you need to name the components in the returned tuple in the method signature:

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

    return (greeting, language)
}

Hope that helps!

Steve.

eric robinson
eric robinson
3,016 Points

Thank you Steve, I've been stuck on this one for 4 days. I see that by naming the strings in the original return made all the difference. I appreciate the help.

No problem - glad it helped!

Steve.