]> git.lizzy.rs Git - rust.git/commitdiff
Match the loop examples
authorStefan Schindler <dns2utf8@estada.ch>
Wed, 24 Jul 2019 22:35:24 +0000 (00:35 +0200)
committerStefan Schindler <dns2utf8@estada.ch>
Tue, 6 Aug 2019 08:48:11 +0000 (10:48 +0200)
src/libstd/keyword_docs.rs

index f5018485ef7bcc05ef02ce8df1bf94f8951be295..5ca518358d7d904a68e481f1c393cf118d6613e3 100644 (file)
@@ -681,14 +681,15 @@ mod while_keyword { }
 ///     # break;
 /// }
 ///
-/// let mut i = 0;
+/// let mut i = 1;
 /// loop {
 ///     println!("i is {}", i);
-///     if i > 10 {
+///     if i > 100 {
 ///         break;
 ///     }
-///     i += 1;
+///     i *= 2;
 /// }
+/// assert_eq!(i, 128);
 /// ```
 ///
 /// Unlike the other kinds of loops in Rust (`while`, `while let`, and `for`), loops can be used as