From 590a88fc3d22811428b847dd32b2dc0821a75e46 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Wed, 21 Aug 2024 16:33:50 +1000 Subject: [PATCH] update break-continue.md (#2287) Move the speak note about "loop" into the page which we actually talk about "loop". Also update the wording to make it more accurate. --------- Co-authored-by: Jason Lin --- src/control-flow-basics/break-continue.md | 9 +++++++++ src/control-flow-basics/break-continue/labels.md | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/control-flow-basics/break-continue.md b/src/control-flow-basics/break-continue.md index e0ae4b88..57d1ec31 100644 --- a/src/control-flow-basics/break-continue.md +++ b/src/control-flow-basics/break-continue.md @@ -27,3 +27,12 @@ fn main() { } } ``` + +
+ +Note that `loop` is the only looping construct which can returns a non-trivial +value. This is because it's guaranteed to only return at a `break` statement +(unlike `while` and `for` loops, which can also return when the condition +fails). + +
diff --git a/src/control-flow-basics/break-continue/labels.md b/src/control-flow-basics/break-continue/labels.md index 27dbdd81..bff046fe 100644 --- a/src/control-flow-basics/break-continue/labels.md +++ b/src/control-flow-basics/break-continue/labels.md @@ -19,11 +19,3 @@ fn main() { print!("elements searched: {elements_searched}"); } ``` - -
- -- Note that `loop` is the only looping construct which returns a non-trivial - value. This is because it's guaranteed to be entered at least once (unlike - `while` and `for` loops). - -