iOS Functions in Swift Functions in Swift Recap: Functions

i really dont understand this please help

i know how to do everything with functions its just the directions are unclear.

functions.swift
// Enter your code below
func temperatureInFahrenheit

1 Answer

Callum Lynch
Callum Lynch
5,642 Points

Im assuming that you're struggling with the first section of this challenge.

I have offered the answer below but to give it some explanation, the question is asking to create a function that uses the temperature as its key. This is therefore the key that is put inside the brackets after the function name. Furthermore, to declare the type, use the : symbol with a space and because the question is asking for a Double Type, thats what we'll use. Additionally it is asking for a return type as well. This is shown by closing the bracket ")" and using -> to indicate a return type...followed by Double which is the type requested. Once the function has been given a name and had its values and types declared, open the function with a { symbol. to return the temperature, simply type out return temperature and then close the whole thing with a }. The correct code is below. I hope this helped.

''' func temperatureInFahrenheit(temperature: Double) -> Double {

return temperature

} '''