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

Ben Masel
Ben Masel
2,004 Points

What should i do now?

I don't know what to do now or if i have made a mistake.

Please help!

functions.swift
// Enter your code below
func temperatureInFahrenheit(temperature: Double) {

}

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there Benjamin! Well you've got the first part set up correctly. But you never tell it what type to return. And then we also have these instructions:

For now, to make the function pass, simply return the value of the temperature parameter from the function. In the next task, we'll add more code to the body.

So your code at the end of the first step should look like this:

// Enter your code below
func temperatureInFahrenheit(temperature: Double) -> Double {
  return temperature
}

We define the function that takes a type Double which will be named temperature inside the function. That part you did just fine. Then we return a double. And in this case, we're going to return temperature. Hope this helps! :sparkles: