iOS Functions in Swift Functions in Swift Recap: Functions

Is the value suppose to the word temperature?

Not sure if I have the math set up properly

functions.swift
// Enter your code below
func temperatureInFahrenheit(temperature: Double) -> Double {
let celciosToFahrenheit = temperature * 9 / 5 + 32
return temperature
}

temperatureInFahrenheit(temperature: 10)

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 144,813 Points

Hi Chris,

I'm guessing you're on task #2?
If yes, the first thing you need to do is delete the function call at the end. The Challenge has not yet asked for this.

Next, you'll have to remember that challenges are very specific and picky when it comes to the instructions. Task #2 does not ask for a new variable to be created (you have made celciosToFahrenheit). The instructions simply want you to modify the return and return the mathematical result directly.
So, your math is correct, but the code is not. You'll need to get rid of the variable assignment and just return the math.

return temperature * 9 / 5 + 32

Other than that... Nice job! :) :dizzy: