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 what I am doing wrong

I am following the video tutorial but I do not realize my error.

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

    return 
}

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi James,

You're almost there, you have setup your return type correctly as a tuple but you're not returning anything from the greeting function. Rather than re-explaining what tuples are and how to use them see the link below which is a post I made a long time ago explaining them.

https://teamtreehouse.com/forum/not-sure-on-the-tuple-question-ios-swift-to-modify-the-greeting-to-return-both-language-and-greeting

The other issue is you have changed the parameter person to be named which isn't required, simply remove the pound/hash symbol so your function signature is instead the following.

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

Hope that helps.

It still won't work