Skip to content

Commit 7488ff5

Browse files
committed
loop_break_value book doc: remove some curiosities, regarding leodasvacas's comments
1 parent 7d94b48 commit 7488ff5

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/doc/unstable-book/src/language-features/loop-break-value.md

+3-13
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,9 @@ Documentation to be appended to section G of the book.
1010

1111
### Loops as expressions
1212

13-
Like most things in Rust, loops are expressions; for example, the following is perfectly legal,
14-
if rather useless:
15-
16-
```rust
17-
let result = for n in 1..4 {
18-
println!("Hello, {}", n);
19-
};
20-
assert_eq!(result, ());
21-
```
22-
23-
Until now, all the loops you have seen evaluate to either `()` or `!`, the latter being special
24-
syntax for "no value", meaning the loop never exits. A `loop` can instead evaluate to
25-
a useful value via *break with value*:
13+
Like most things in Rust, loops are expressions, and have a value; normally `()` unless the loop
14+
never exits.
15+
A `loop` can instead evaluate to a useful value via *break with value*:
2616

2717
```rust
2818
// Find the first square number over 1000:

0 commit comments

Comments
 (0)