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 trial

iOS Functions in Swift Adding Power to Functions Returning Complex Values

Tariq Qazzaz
Tariq Qazzaz
1,660 Points

Missing Somthing in my Tuple ?

Hi Guys // Enter your code below func coordinates (for location:String) -> (Double,Double) {

switch location { case "Eiffel Tower" : return (48.8582 , 2.2945) case "Great Pyramid" : return (29.97922 , 31.1344) case "Sydney Opera House" : return (33.8587 , 151.2140) default : return (0.0 , 0.0) }

}

i couldnt find the problem in my code ..

would you please help me

functions.swift
// Enter your code below
func coordinates (for location:String) -> (Double,Double) {

  switch location {
  case "Eiffel Tower"       : return (48.8582 , 2.2945)
  case "Great Pyramid"      : return (29.97922 , 31.1344)
  case "Sydney Opera House" : return (33.8587 , 151.2140)
  default                   : return (0.0 , 0.0)
  }

}

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You simply have a typo in one of the values you're returning. The problem is with the value returned by "Great Pyramid".

// You typed 
return (29.97922 , 31.1344)

// That should be 
return (29.9792 , 31.1344)

Note the removal of the extraneous 2 on the latitude of the second version.

Hope this helps! :sparkles:

Tariq Qazzaz
Tariq Qazzaz
1,660 Points

Awww .. thank you so much . appreciate it .

István Halász
István Halász
2,896 Points

Hi, you only mistyped the Great Pyramids' coordinates. Instead of writing (29.9792, 31.1344), you wrote (29.97922 , 31.1344). You just wrote an extra 2 :)

Tariq Qazzaz
Tariq Qazzaz
1,660 Points

thank you so much .. it worked . easy mistake got me stuck for 30 minutes .