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

please return the correct values bla bla black

help meet

functions.swift
// Enter your code below
func coordinates(for location: String)->(Double, Double){
  var d: Double
  var dd: Double
  if(location == "Eiffel Tower"){
    d = 48.8582
    dd = 2.2945
  }
  else{
    d = 0
    dd = 0
  }
  return (d,dd)
}

1 Answer

Anthony Lafont
Anthony Lafont
17,075 Points

Hi Ramzy,

Your answer is right! The only reason why you didn't passed the challenge is just because you did the code only for the Eiffel Tower, but you have to do it also for the Great Pyramid and the Sydney Opera House!

here is the code:

func coordinates(for location: String)->(Double, Double){
    var d: Double
    var dd: Double
    if(location == "Eiffel Tower"){
        d = 48.8582
        dd = 2.2945
    }
    else if(location == "Great Pyramid"){
        d = 29.9792
        dd = 31.1344
    }
    else if(location == "Sydney Opera House"){
        d = 33.8587
        dd = 151.2140
    } else {
        d = 0
        dd = 0
    }
    return (d,dd)
}

Anthony