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 trialArmen Melik-Abramians
2,307 PointsWhy is this code NOT working??
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) } }
1 Answer
Adam Moore
21,956 PointsI should work. I even simply copied and pasted your code into the challenge, and it worked for me. So, I'm not sure why it isn't working for you.
Armen Melik-Abramians
2,307 PointsThanks Adam! I pasted my code again, and it worked. Not sure what was happening before. Thanks for all your help.
Brennan Altringer
7,660 PointsBrennan Altringer
7,660 PointsHave you tried setting the value of the case to a variable then returning one variable after the switch statement? A lot of returns makes the code a little messy. This way you can see what the variable is at the end of your code for diagnosis?