File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 144
144
/// every value of the `tempsFahrenheit` array, any NaN values cause the
145
145
/// result to also be NaN, as seen in this example:
146
146
///
147
- /// let badAverage = tempsFahrenheit.reduce(0.0, combine: +) / Double(tempsFahrenheit.count)
147
+ /// let badAverage = tempsFahrenheit.reduce(0.0, +) / Double(tempsFahrenheit.count)
148
148
/// // badAverage.isNaN == true
149
149
///
150
150
/// Instead, when you need an operation to have a specific numeric result,
151
151
/// filter out any NaN values using the `isNaN` property.
152
152
///
153
153
/// let validTemps = tempsFahrenheit.filter { !$0.isNaN }
154
- /// let average = validTemps.reduce(0.0, combine: +) / Double(validTemps.count)
154
+ /// let average = validTemps.reduce(0.0, +) / Double(validTemps.count)
155
155
///
156
156
/// Finally, report the average temperature and observation counts:
157
157
///
You can’t perform that action at this time.
0 commit comments