iOS Functions in Swift Functions in Swift Recap: Functions

mark hengstebeck
mark hengstebeck
1,119 Points

Recap: functions-step 3 of 3.

How to assign the result of a function to a constant named FahrenheitTemp? Will someone provide me with a hint. // Enter your code below func temperatureInFahrenheit(temperature: Double) -> Double { let temperatureInFahrenheit = temperature * 9 / 5 + 32 return temperatureInFahrenheit } temperatureInFahrenheit(temperature: 24.0)

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

2 Answers

Stephen Gheysens
Stephen Gheysens
11,935 Points

Hi Mark,

The first problem you're going to encounter is that you're naming the constant and the function the same thing (temperatureInFahrenheit). Without writing it for you, the challenge is looking for something more along the lines of:

func funcName () {
  return val
}

let const = funcName(argument)

Let me know if you have any questions!

Sincerely,

Stephen

mark hengstebeck
mark hengstebeck
1,119 Points

Hi Stephen, That's it! Thanks, Mark