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 trialMatt Conway
1,572 PointsValue
Not sure what value to put in the let statement
Challenge Task 1 of 3
Declare a function named temperatureInFahrenheit. The function should take a single input named temperature of type Double and has a return type of Double.
For now, to make the function pass, simply return the value of the temperature parameter from the function. In the next task, we'll add more code to the body.
/Users/mattconway/Desktop/Screen Shot 2016-01-16 at 1.08.00 PM.png
// Enter your code below
func temperatureInFahrenheit(temperature: Double) {
let temperature =
return temperature
}
4 Answers
Matt Conway
1,572 PointsStill not clear ... can you give me an example
/Users/mattconway/Desktop/Screen Shot 2016-01-16 at 1.42.22 PM.png
Emil Rais
26,873 PointsYou should return the value of temperature, almost in the way you attempted. The "let =" does not belong there as that is used for storing values in constants; and here you should simply return the value. Also you need to specify the return type of the function.
Emil Rais
26,873 Pointsfunc someFunctionName(/* This is where you place parameters */) -> /* This is where you place the return type if any */ {
return /* You can return some value here */
}
func wordInEnglish(word: String) -> String {
return word
}
Matt Conway
1,572 Pointsok got it, thanks.
Emil Rais
26,873 PointsGlad to hear it; happy coding!