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!
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
yusuf Dibswazit
1,522 PointsAnyone out there? please help. thanx
Don't know what to do
// Enter your code below
func getTowerCoordinates(location: string) -> ( Double, Double) {
switch {
case "Eifel 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)
}
return ( Double, Double)
}
let location = getTowerCoordinates(Double, Double )
2 Answers

Tobias Helmrich
31,602 PointsHey there,
unfortunately you have multiple mistakes in your code:
- You have to write the type String for the location parameter in uppercase
- You forgot to specify the variable/constant, in this case the parameter
location
, the switch statement should compare its cases to - There's a small typo in "Eiffel Tower", note the additional "f"
- There shouldn't be colons after your return statement
- You can remove the return statement in the end as you're already returning the values in the switch block
- You don't have to assign the result of the function to a constant yourself in the end, this will happen automatically when the challenge is evaluated. But also note that it would be wrong if you write it like this because the parameter takes a String and you're writing the type Double two times
If you fix all the mistakes it should look somehow like this:
// Enter your code below
func getTowerCoordinates(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)
}
}
I hope that helps, good luck!

jcorum
71,828 PointsString must be capitalized (as the input parameter type). switch has to have a value to switch on (here it's location). You also have an extra return statement.
func getTowerCoordinates(location: String) -> (Double, Double) {
switch location {
case "Eiffel Tower":
return (lat: 48.8582, lon: 2.2945)
case "Great Pyramid":
return (lat: 29.9792, lon: 31.1344)
case "Sydney Opera House":
return (lat: 33.8587, lon: 151.2140)
default:
return (lat: 0,lon: 0)
}
}