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 trialRuben Mercado
1,933 Pointsdon't know
don't know what to return
// Enter your code below
func coordinates(for location: String) -> (Double, Double){
switch location{
case "Eiffel Tower" : print(48.8582, 2.2945)
case "Great Pyramid": print(29.9792, 31.1344)
case "Sydney Opera House" : print(33.8587, 151.2140)
default: print(0,0)
return location
}
}
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Ruben,
You are on the right track but have a look at the instructions again. Instructions are very specific in what they ask and must be followed exactly.
Your syntax is all correct, but not what the challenge instructions ask for.
First, the final return you have (return location
) is not need, nor is it asked for. The instructions do explicitly say that each case (including the default
) should return "a tuple containing two Double values", but you are attempting to print them instead.
If you delete that final return statement and fix up the code to match the instructions (return
instead of print
) the challenge will pass.
Other than that... Great job!! :)
Keep Coding!
Binh Tri
1,920 PointsHi Ruben, From what I know, you could create 2 variables named lat and lon in the function. Then in each case, you assign the values for lat and lon. Ex: case "Eiffel Tower": lat = 48.8582; lon = 2.2945. For default case just assign 0. The return syntax should be outside of the curly braces of switch command. Then you should return both lat and lon in the end. Hope it helps!