Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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