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 trialnader adam
Courses Plus Student 548 Pointswhere is the wrong here
// Enter your code below func coordinates(for location: String) -> (Double , Double) { return value }
let value = coordinates(for: "Eiffel Tower") value.0 value.1
// Enter your code below
func coordinates(for location: String) -> (Double , Double)
{
return value
}
let value = coordinates(for: "Eiffel Tower")
value.0
value.1
1 Answer
Michael Afanasiev
Courses Plus Student 15,596 PointsHi Nader,
For this challenge, we can use switch statements
I will try to give you some hints so you can complete it yourself! ?
// Declaring the function (You got that exactly right!)
func coordinates(for location: String) -> (Double, Double) {
switch location {
// Choose your 3 cases below and return their longitude and latitude
case "some location": return (1.234567, 2.4567891)
// After choosing your cases, don't forget that we need to add a default state as per the challenge
// "If a string is passed in that doesnβt match the set above, return (0,0)"
}
}
I hope this helps a bit, let me know if there is still something you don't understand. βοΈ