Rollup merge of #62957 - dns2utf8:doc_loop_keyword, r=GuillaumeGomez
Match the loop examples The idea is to show the usefulness of the expression side by side.
This commit is contained in:
commit
c96a677c39
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue