From db4003ea8f057feb7b35bb770dd412f56f647302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=80=D0=B0=D1=81=D0=B8=D0=BC=D0=B8=D1=80=20=D0=91?= =?UTF-8?q?=D0=B5=D1=80=D0=BE=D0=B2?= Date: Thu, 27 Jul 2023 15:46:17 +0300 Subject: [PATCH] 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. --- src/fn/hof.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fn/hof.md b/src/fn/hof.md index 88918cb522..9be5b41fec 100644 --- a/src/fn/hof.md +++ b/src/fn/hof.md @@ -10,7 +10,7 @@ fn is_odd(n: u32) -> bool { } fn main() { - println!("Find the sum of all the squared odd numbers under 1000"); + println!("Find the sum of all the numbers with odd squares under 1000"); let upper = 1000; // Imperative approach