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

I'm lost

Please assist!

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

    var result = ("Tom")

    return (greeting, language)

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Michael,

You have the return type setup correctly but you've also changed the name of the function and removed the person parameter which wasn't asked of you and you've also declared task 2 within the greeting function whereas it needs to be declared on the outside as well as you need to called the greeting function which you're currently not doing.

See the below.

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

  return (greeting, language)

var result = greeting("Tom")

Hope that helps.

I know my variable isn't correct, I'm aware that it isn't being passed to the greeting function. But I have no idea how to do it.