Wiki

Changes between Version 2 and Version 3 of WhileStatement

Show
Ignore:
Timestamp:
12/23/10 08:53:40 (14 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WhileStatement

    v2 v3  
    33=== Grammar === 
    44{{{ 
    5 while-statement = 
    6     [post] while <expression> 
    7         <statements> 
     5 
     6[post] while <expression> 
     7    <statements> 
    88}}} 
    99 
    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. 
     10Without the '''post''', the expression is first evaluated and while true, the statements are executed. [[BR]] 
     11If the expression evaluates false the first time, the statements will not execute.  
    1112 
    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). 
     13With  '''post''', the condition is evaluated after the statements execute, so the statements will execute at least once. 
     14 
     15Inside 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). 
    1316 
    1417{{{