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

Correct Answer for the Task Tuples and Parameters

This is my reply, but it is wrong. What is the correct answer ?

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

    return greeting
}

greeting("John")

2 Answers

Which 1 of 3 challenges are you stuck on? If it is the first one, you need to add named parameters.

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

When I tried it, it would not take my answer until I did so.

If it is part two, you need to assign your "Tom" to a variable. I did so like so:

let result = greeting("Tom")

Thanks. That worked. I appreciate the quick answer.

No problem!