Changes between Version 3 and Version 4 of WhileStatement
- Timestamp:
- 12/23/10 09:05:56 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WhileStatement
v3 v4 1 1 = While Statement = 2 The '''while''' statement is used to repeatedly execute code while a condition is true. 2 Repeatedly execute code while a condition is true.[[BR]] 3 Evaluate the condition either before executing the code ( the first time) or afterwards. 3 4 === Grammar === 4 5 {{{ … … 9 10 10 11 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.12 If the expression evaluates false the first time, the statements will not be executed. 12 13 13 14 With '''post''', the condition is evaluated after the statements execute, so the statements will execute at least once. 14 15 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). 16 Inside the statements, a '''break''' statement will exit the loop and a '''continue''' statement will skip the remaining statements and 17 cause evaluation of 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). 16 18 17 19 {{{