Skip to content

Commit db4003e

Browse files
committed
Misleading textual statement in HOF
The example checks if the calculated square is less than 1000, and if it is odd, then adds it to the sum - not if the not squared number is odd. The amount of calculations is much lower than if it was checking if the not squared number is less than 1000 and then square it and add it to the sum.
1 parent 07e0df2 commit db4003e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fn/hof.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn is_odd(n: u32) -> bool {
1010
}
1111
1212
fn main() {
13-
println!("Find the sum of all the squared odd numbers under 1000");
13+
println!("Find the sum of all the numbers with odd squares under 1000");
1414
let upper = 1000;
1515
1616
// Imperative approach

0 commit comments

Comments
 (0)