iOS Functions in Swift Functions in Swift Recap: Functions

NAVEED CHOWDHURY
NAVEED CHOWDHURY
1,142 Points

CelciusFarenheit Problem

when I type the code in Playground there is no error but the treehouse compiler giving error.

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

    return (temperature * 9)/5 + 32

}

let farenheitTemp = temperatureInFahrenheit(temperature: 20.40)

1 Answer

Jeff McDivitt
Jeff McDivitt
23,964 Points

There is no need for two functions?

func temperatureInFahrenheit(temperature: Double) -> Double {

   return temperature * 9 / 5 + 32


}