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

Not sure where my code is wrong; cannot advance to the next level...

Here's my code, where is it incorrect? Checked it in Xcode as well. Thank you :)

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

return (greeting, language)

}

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

    return (greeting, language)
}

2 Answers

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

Yes, your code should work fine on latest Xcode, but the challenge is specifically requiring this

Make sure to name each item in the tuple: greeting and language.

So you need to name them in the return types.

func greeting (person: String) -> (greeting:String, language:String) {

Thank you :)