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

ARMANDO RODRIGUEZ
ARMANDO RODRIGUEZ
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.

functions.swift
// 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).

ARMANDO RODRIGUEZ
ARMANDO RODRIGUEZ
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.