Skip to content

Commit fe433ea

Browse files
author
rjdestigter
authored
Fix return type of forecastInFahrenheit
forecastInFahrenheit returns a `Seq[Double]`, not a `Double`
1 parent b3e10c0 commit fe433ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: _tour/higher-order-functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ case class WeeklyWeatherForecast(temperatures: Seq[Double]) {
5353
5454
private def convertCtoF(temp: Double) = temp * 1.8 + 32
5555
56-
def forecastInFahrenheit: Double = temperatures.map(convertCtoF) // <-- passing the method convertCtoF
56+
def forecastInFahrenheit: Seq[Double] = temperatures.map(convertCtoF) // <-- passing the method convertCtoF
5757
}
5858
```
5959
Here the method `convertCtoF` is passed to forecastInFahrenheit This is possible because the compiler coerces `convertCtoF` to the function `x => convertCtoF(x)` (note: `x` will

0 commit comments

Comments
 (0)