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 trialJesse Gay
Full Stack JavaScript Techdegree Student 14,045 PointsWhat 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?
// 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
Treehouse TeacherHi 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!
edited for additional information
I could be mistaken here, but I believe there's an implicit conversion from Int
to Double
in that default.
Jesse Gay
Full Stack JavaScript Techdegree Student 14,045 PointsThanks Jennifer and Michael! I've been staring at the screen too long and missed the typo :) Time for a break.
Michael Hulet
47,913 PointsMichael Hulet
47,913 PointsThe implicit conversion is ok, though. The compiler is fine with it, and I like the style imo
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherSame Michael Hulet. I agree that
return(0, 0)
looks much nicer thanreturn(0.0, 0.0)