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

Sean Lafferty
Sean Lafferty
3,029 Points

HELP PLEASE

Thought I was really getting somewhere with this but now I just cant get past it -

help would be apprectiated

Sean

functions.swift
// Enter your code below

func temperatureInFahrenheit(temperature: Double) -> Double {

    temperature *= 9.0
    temperature /= 5
    temperature + 32.0



  }

2 Answers

Jonathan Ruiz
Jonathan Ruiz
2,998 Points

Hi Sean you set up the function and parameters correctly the part that isn't letting you pass is the body of the statement. there isn't a return statement and you have separate lines for the calculation they want. It must be on a single line and written just like a math problem where you have the operations performed in the order they ask. So you need to return temperature and run the calculation.

let example = ((temperature * 2) / 4 + 44)

hope this helps !

Looks like the issue is you aren't returning the temperature in that function:

// Enter your code below

func temperatureInFahrenheit(temperature: Double) -> Double {

    temperature *= 9.0
    temperature /= 5
    temperature + 32.0
    return temperature
  }