iOS Functions in Swift Functions in Swift Recap: Functions

John Gilmer
PRO
John Gilmer
Pro Student 3,782 Points

Not sure what I am doing wrong?

?

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

1 Answer

Brandon Mahoney
Brandon Mahoney
iOS Development with Swift Techdegree Graduate 30,144 Points

So close. The result of the equation you wrote wasn't captured by any object.

func temperatureInFahrenheit(temperature: Double) -> Double {
  let celciusTemp = temperature * 9 / 5 + 32
  return celciusTemp
}
Brandon Mahoney
Brandon Mahoney
iOS Development with Swift Techdegree Graduate 30,144 Points

I forgot to explain that parameters are 'let' constants so you can't directly change there value there fore the necessity of 'celciusTemp'.