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 Functions in Swift Adding Power to Functions Returning Complex Values

Sean Lafferty
Sean Lafferty
3,029 Points

Not quit sure of this

DOnt understand, please look at my code and help!

Thanks, Sean

functions.swift
// Enter your code below

var eiffelTower = (48,8582, 2.2945)
var greatPyramid = (29.9792, 31.1344)
var sydneyOperaHouse = (33.8587, 151.2140)

func coordinates(for location: String) -> (Double, Double) {
    switch location {
    case "Eiffel Tower" : eiffelTower
    case "Great Pyramid" : greatPyramid
    case "Sydney Opera House" : sydneyOperaHouse
    default location = 0

}

}

1 Answer

Hi Sean!

You are very close!

Firstly you have put a comma where the should be a period.

var eiffelTower = (48,8582, 2.2945)

should be:

var eiffelTower = (48.8582, 2.2945)

Just a quick tip: switch statements should RETURN a value for each case. For example:

case name: return "Sean"

Also, your default value is returning an INT value not (Double, Double)

default: return (0.0, 0.0)

I hope you can figure it out from there.

If not, feel free to ask for more help!

Mitch