Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialrico petrini
92 Pointsi really dont understand this please help
i know how to do everything with functions its just the directions are unclear.
// Enter your code below
func temperatureInFahrenheit
1 Answer
Callum Lynch
5,972 PointsIm 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
} '''