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
  }