Changes between Version 2 and Version 3 of WhileStatement
- Timestamp:
- 12/23/10 08:53:40 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WhileStatement
v2 v3 3 3 === Grammar === 4 4 {{{ 5 while-statement = 6 7 5 6 [post] while <expression> 7 <statements> 8 8 }}} 9 9 10 Without the '''post''', the expression is checked first and while true, the statements are repeatedly executed. If the expression is false the first time, the statements will not execute. With the '''post''', the condition is checked after the statements execute, so the statements will execute at least once. 10 Without the '''post''', the expression is first evaluated and while true, the statements are executed. [[BR]] 11 If the expression evaluates false the first time, the statements will not execute. 11 12 12 Inside the statements, a '''break''' statement will exit the loop and a '''continue''' statement will skip the remaining statements and evaluate the expression again. In either case, an '''if''' statement is used to control when the loop is broken or continued (otherwise it would be pointless to have further statements in the loop). 13 With '''post''', the condition is evaluated after the statements execute, so the statements will execute at least once. 14 15 Inside the statements, a '''break''' statement will exit the loop and a '''continue''' statement will skip the remaining statements and evaluate the expression again. In either case, an '''if''' statement should be used to control when the loop is broken or continued (otherwise it would be pointless to have further statements in the loop). 13 16 14 17 {{{