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 Swift 2.0 Functions Function Parameters Returning Complex Values

Is there any error in the code?

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.857, 151.2140) default : return (0,0) } }

Jake Adams
Jake Adams
1,608 Points

Can you update your question to add the Markdown code styling to it? It will make this much easier to read

15 Answers

Jake Adams
Jake Adams
1,608 Points

I can confirm, using Xcode playground that your code compiles. Whether the information is correct, I do not know :)

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.857, 151.2140)
    default : return (0,0)
  }
}

Thanks all I needed was the confirmation. The info is correct but mine does not compile.

Jake Adams
Jake Adams
1,608 Points

Can you post a link to the challenge? I can help figure it out with you if you'd like

I have figured out, Thanks alot

Steven Deutsch
Steven Deutsch
21,046 Points

Jake Adams have you just been grinding all day? Do you have a specific goal? Let me know when you sleep so I can try and answer some questions ;)

Jake Adams
Jake Adams
1,608 Points

Steven Deutsch I got a little addicted :) I like answering questions as it's a good way for me to learn. I've been a developer for many years, but I'm new to Objective-C and Swift. Mostly today, I spent preparing for a talk that I gave tonight, so I was answering questions during my many breaks

Jake Adams
Jake Adams
1,608 Points

Also, Abdijabar Mohamed and Steven Deutsch, ya'll are adding "answers" to this question. Be sure to use the "Add Comment" button instead of the answer box, to help keep the questions cleaner :)

Steven Deutsch
Steven Deutsch
21,046 Points

Sorry! The discussion got so long I didn't notice. I hope your talk went well. In what area is your development experience if you don't mind me asking?

My goal is to finish 2 hours and be able to do some more coding. What about you?

Steven Deutsch
Steven Deutsch
21,046 Points

I've just been studying/coding since 5:30am with breaks every few hours when my brain shuts down

which school do you go to?

It is 5.50 am here in California and I will be on and on off in my coding sessions , until 2 am

Steven Deutsch
Steven Deutsch
21,046 Points

I'm not in school. I work as a flooring contractor and do interior remodeling. I've completed two years towards a Bachelors in Economics but I'm not interested in the field any longer. I took a month off work to self study software development. How about you?

I am a computer science major at Middlebury College, Vt, USA and I realize that in school no one teaches you about app development so I guess I will be deeply immersed in TeamTreeHouse for a while. Do you have any app that you developed/ developing. Where do you live?

Steven Deutsch
Steven Deutsch
21,046 Points

The educational system not teaching enough development is one of the reasons why I did not restart my major and pursue a bachelors in computer science. I do, however, lack the technical foundation by not doing so. I'm new to programming and software development. I haven't developed anything before but I would love to be able to build things some day! I'm from Chicago, IL.

As much as I am a major ( I declared it a month ago) but we are at the same level now, if you are not better actually. I think it would be good to work together and develop something together. I will add you on facebook if you want and we can keep in touch.

Steven Deutsch
Steven Deutsch
21,046 Points

Yeah, no problem. I had to re-activate my Facebook, I never use it. I was thinking of creating a Twitter soon to network with developers. Do you have one?

I am not a big fan of twitter man ,haha

Abdi Jabar