Vanguard Software
Forecasting & Planning Solutions
Home Products Solutions Services Customers Partners Company
 
Applying science to business management

contents.gifindex.gifprev1.gifnext1.gif

continue

The continue statement is similar to break in that it terminates execution of a part of a loop. However, unlike break, continue only skips execution of the remaining steps in the current iteration instead of terminating the entire loop.

For example, the following code adds all positive numbers in list:

var total=0,n;
for(n=0; list[n]!=null; n++) {
if(list[n]<0)
  continue;
total+=list[n];
}

This example is exactly like the first example using break, except that continue is substituted for break. In this example, each time you encounter a negative number, the remaining steps in the current loop are skipped. Since there is only one remaining step in the statement block, total+=list[n];, the loop is effectively just summing positive list elements.

  Demand Planning  |  Financial Forecasting
Forecasting Software  |  Strategic Planning Software  |  Decision Tree Software
Decision Support Software  |  Expert System Software  |  Online Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2011 Vanguard Software Corporation
Print this page   Email this page to a friend