iOS Functions in Swift Functions in Swift Recap: Functions

confused on double and return error here.

Confused on bummer error here base on code.

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

2 Answers

Connor Walker
Connor Walker
16,015 Points

The problem is that you havn't told the function to return anything, you have only declared the function. All you need to do is return the temperature variable, like this:

func temperatureInFahrenheit(temperature: Double) -> Double {

  return temperature
}
Stuart Wright
Stuart Wright
41,024 Points

You simply need to add the following inside the function body:

  return temperature

The reason for the error in your code is that you have said in the function header that a Double will be returned, but then you return nothing.