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

I don't know whats wrong with my function?

I can't figure out whats wrong with my function it says I need to pace a single parameter which I thought I did but I know there is something else wrong with this code can anyone help me?

functions.swift
// Enter your code below

func coordinates(location: String) ->(Double, Double) {
     switch location {
    case "Eiffel Tower":
        return (lat: 48.8582, lon: 2.2945)
    case "Great Pyramid":
        return (at: 29.9792, lon: 31.1344)
    case "Sydney Opera House":
        return (lat: 33.8587, lon: 151.2140)
    default: (0,0)
    }
    return (0,0)
]

1 Answer

Jonathan Ruiz
Jonathan Ruiz
2,998 Points

Hi Derrick your really close ! There was just two things that you missed. The first is a simple typo at the bottom instead of a closing } you have a ]. The second part is for the parameter of the function. This parameter needs a external name of "for" and an internal name of "location". You only wrote the local name location. For functions the external name is what reads when you call the function. And the internal name is what you use inside the body of the function to reference the argument you will be passing in.

func example(external local: String) -> String {
// body of the function 
}

Hope this helps !