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 am stuck on the 3rd objective

How am I supposed to use the println statement to print English using the results tuple if the results tuple is a variable and not a tuple. It only has greeting within it and not language. I may be misunderstanding the directions. I am not really sure what I am doing wrong. Please help. Here is my code:

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

    return (greeting, language)
}

var result = greeting("Tom")

println(greeting(language))

1 Answer

These code challenges almost always builds each line of code upon the other... So think about how you would use the variable result where you stored a tuple returned from the greeting(). If you give up, I will hand you the answer :)

Hint: you only need to call greeting() one time in this challenge.

Yes! Just got it. Thanks for the hint. That helped me a lot. Thanks again.