@@ -1991,28 +1991,19 @@ way.
19911991
19921992* TODO* .
19931993
1994- ### While expressions
1994+ ### While loops
19951995
19961996~~~~~~~~ {.ebnf .gram}
19971997while_expr : "while" expr '{' block '}'
19981998 | "do" '{' block '}' "while" expr ;
19991999~~~~~~~~
20002000
2001- A ` while ` expression is a loop construct. A ` while ` loop may be either a
2002- simple ` while ` or a ` do ` -` while ` loop.
2001+ A ` while ` loop begins by evaluating the boolean loop conditional expression.
2002+ If the loop conditional expression evaluates to ` true ` , the loop body block
2003+ executes and control returns to the loop conditional expression. If the loop
2004+ conditional expression evaluates to ` false ` , the ` while ` expression completes.
20032005
2004- In the case of a simple ` while ` , the loop begins by evaluating the boolean
2005- loop conditional expression. If the loop conditional expression evaluates to
2006- ` true ` , the loop body block executes and control returns to the loop
2007- conditional expression. If the loop conditional expression evaluates to
2008- ` false ` , the ` while ` expression completes.
2009-
2010- In the case of a ` do ` -` while ` , the loop begins with an execution of the loop
2011- body. After the loop body executes, it evaluates the loop conditional
2012- expression. If it evaluates to ` true ` , control returns to the beginning of the
2013- loop body. If it evaluates to ` false ` , control exits the loop.
2014-
2015- An example of a simple ` while ` expression:
2006+ An example:
20162007
20172008~~~~
20182009# let mut i = 0;
@@ -2024,18 +2015,6 @@ while i < 10 {
20242015}
20252016~~~~
20262017
2027- An example of a ` do ` -` while ` expression:
2028-
2029- ~~~~
2030- # let mut i = 0;
2031- # let println = io::println;
2032-
2033- do {
2034- println("hello\n");
2035- i = i + 1;
2036- } while i < 10;
2037- ~~~~
2038-
20392018### Infinite loops
20402019
20412020A ` loop ` expression denotes an infinite loop:
0 commit comments