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

Jesse Gay
seal-mask
.a{fill-rule:evenodd;}techdegree
Jesse Gay
Full Stack JavaScript Techdegree Student 14,045 Points

What am I missing? Code works in Xcode but won't pass.

Does anyone know why this isn't passing? I looked at other solutions, and one of them seems identical to mine, but I can't get this one to pass. It works in Xcode.

Also, why is (0,0) acceptable for the default return case (per the instructions)? Doesn't the function need to return a Tuple of Doubles?

functions.swift
// Enter your code below
func coordinates(for location: String) -> (Double, Double) {
    switch location {
    case "Eiffel Tower":
        return(48.8582, 2.2945)
    case "Great Pyramid":
        return(29.9792, 31.1344)
    case "Syney Opera House":
        return(33.8587, 151.2140)

    default:
        return(0,0)
    }
}

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Nope, this will not create an error in Xcode. Check very closely your spelling of "Sydney Opera House". You've accidentally typed "Syney" instead of "Sydney". You missed a "d" in there. Other than that, you're doing terrific!

Hope this helps! :sparkles:

edited for additional information

I could be mistaken here, but I believe there's an implicit conversion from Int to Double in that default. :smiley:

Michael Hulet
Michael Hulet
47,913 Points

The implicit conversion is ok, though. The compiler is fine with it, and I like the style imo