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 trialNAVEED CHOWDHURY
1,142 PointsCode Challenge Geographical Coordinates
I am kind of stuck here, can anyone explain me what am I doing wrong here, Thanks in advance.
/func coordinates(for location: String)-> (lat: Double, lon: Double) {
switch location {
case "Eiffel Tower":
return (48.8582, 2.2945)
case "Great Pyramid":
return (29.9792, 31.1344)
case "Sydney Opera Houese":
return (33.8587, 151.2140)
default:
return (0,0)
}
}
3 Answers
Xavier D
Courses Plus Student 5,840 PointsHey Naveed,
Perhaps one or two things...
...one...removing that forward slash right before your function definition should get your code to compile and run correctly...
...two...perhaps removing the labels in your return parameter list? I've noticed that sometimes putting in stuff that is not required may produce errors in the challenges...
Jeff McDivitt
23,970 PointsThere are two error in your code
- The task does not ask you to return lat and long, you do not need it in your return method
- In Sydney Opera House you mis spelled house
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 "Sydney Opera House":
return (33.8587, 151.2140)
default:
return (0,0)
}
}
NAVEED CHOWDHURY
1,142 PointsThanks a lot everyone, much appreciated.
Xavier D
Courses Plus Student 5,840 Pointsno problem...
XD
Xavier D
Courses Plus Student 5,840 PointsXavier D
Courses Plus Student 5,840 PointsHey Naveed,
Perhaps one or two things...
...one...removing that forward slash right before your function definition should get your code to compile and run correctly...
...two...perhaps removing the labels in your return parameter list? I've noticed that sometimes putting in stuff that is not required may produce errors in the challenges...