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 Swift 2.0 Functions Functions in Swift 2.0 Recap: Functions

4,216 Points

This keeps failing and throwing me an error... I keep trying to submit the correct code and it keeps crashing.

Every time I try to declare func temperatureInFahrenheit (temperature: Double) -> Double { return temperature } it crashes.

// Enter your code below

3 Answers

Here you go:

func temperatureInFahrenheit(temperature: Double) -> Double {
  return temperature * 9 / 5 + 32
let fahrenheitTemp = temperatureInFahrenheit(24.0)

The function takes a Double named temperature as an input parameter, and returns a Double ( -> Double).

4,216 Points

Yeah that is what I was doing.
There was an error with the website so it was crashing. Very weird.

Ah! Sorry, I misunderstood, as you didn't show your complete code. Yes, I've been having the same problem. Many, many Oh no!s. In fact, 23 yesterday until I just gave up and stopped working. I've sent an email to the helpdesk about it.