From 7488ff5c44f8e7515aa68e43011784de0893a6a6 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Tue, 9 May 2017 19:34:00 +0100 Subject: [PATCH] loop_break_value book doc: remove some curiosities, regarding leodasvacas's comments --- .../src/language-features/loop-break-value.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/doc/unstable-book/src/language-features/loop-break-value.md b/src/doc/unstable-book/src/language-features/loop-break-value.md index dae04d737b7..7218cad1c22 100644 --- a/src/doc/unstable-book/src/language-features/loop-break-value.md +++ b/src/doc/unstable-book/src/language-features/loop-break-value.md @@ -10,19 +10,9 @@ Documentation to be appended to section G of the book. ### Loops as expressions -Like most things in Rust, loops are expressions; for example, the following is perfectly legal, -if rather useless: - -```rust -let result = for n in 1..4 { - println!("Hello, {}", n); -}; -assert_eq!(result, ()); -``` - -Until now, all the loops you have seen evaluate to either `()` or `!`, the latter being special -syntax for "no value", meaning the loop never exits. A `loop` can instead evaluate to -a useful value via *break with value*: +Like most things in Rust, loops are expressions, and have a value; normally `()` unless the loop +never exits. +A `loop` can instead evaluate to a useful value via *break with value*: ```rust // Find the first square number over 1000: