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

Stuck again on this challenge

keep getting stuck at the challenge

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


    return greeting

}

1 Answer

Daniel Sattler
Daniel Sattler
4,867 Points

Try this:

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

let language = "English"

let greeting = "Hello \(person)"

var greet = (language,greeting)

return greet

}

Basically you will need to assign your tuple to a variable (or constant) and then return THAT new variable

I hope this leads you in the right direction ;-)

thanks Daniel, unfortunately I'm stuck for the last 20 min on the next challenge which I just posted for help.