Wiki

Changes between Initial Version and Version 1 of Continue

Show
Ignore:
Timestamp:
03/23/10 10:50:43 (15 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Continue

    v1 v1  
     1= Continue Statement = 
     2The '''continue''' statement forces transfer of control to the controlling expression of the nearest (smallest) enclosing  loop. 
     3 
     4Any remaining statements in the current iteration are not executed. The next iteration of the loop is determined as follows: 
     5 
     6    * In a  while loop, the next iteration starts by reevaluating the controlling expression of the while statement. 
     7    * In a for loop, continue causes the loop counter to increment or enumerator step to be executed[[BR]] 
     8      then the loop termination cond-expr is reevaluated and, depending on the result, the loop either terminates or another iteration occurs. 
     9 
     10== Grammar == 
     11{{{ 
     12continue 
     13}}} 
     14== Example == 
     15 
     16The following example shows how the continue statement can be used to bypass sections of code and begin the next iteration of a loop. 
     17{{{ 
     18def main is shared 
     19    i = 0 
     20    post while i < 3    # do 
     21        i += 1 
     22        print 'before the continue' 
     23        continue 
     24        print 'after the continue, should never print' 
     25 
     26     print 'after the do loop' 
     27 
     28# Outputs: 
     29 
     30before the continue 
     31before the continue 
     32before the continue 
     33after the do loop 
     34}}}