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

How should I proceed?

How should I proceed with the code?

I thought just changing the "return greeting" to "return (greeting, language)" would do it, but apparently not.

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

    return greeting
}

what was the question asked ?

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Ceonn Bobst :

Well, you were on the right track, but you are missing something else.

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

    return (greeting,language) // Your suggestion ?
/*
   altho this is correct, you have to see your method signature.
   Your method signature says that you are going to return a string,
   but you need to return 2 strings. Which is a tuple. 
*/

}

I don’t really want to give you straight up answer, because it may help you more to try to figure it out on your own with some help. BUT if you can’t figure it out, Ill be more than happy to explain with details.

Jhoan