next up previous contents
Next: 3.2 MDL Classes Up: 3.1.10 Controlling the Program Previous: 3.1.10.3 The break Statement

3.1.10.4 The continue Statement

With the continue expression the execution of MDL statements within the body of any kind of loop expressions is immediately interrupted and the conditional expression evaluated. If the condition results in the true value, the loop is continued at the first expression of expression_list.

Example 3.9 demonstrates a possible usage of continue and break statements by extracting a list of all dopants chargedDopings with positive or negative charge out of the list of all available dopants. Any dopant with an internal type different from concentration will cause an error and the while statement to be aborted.

\includegraphics[width=0.6cm]{figures/exaLeft.eps}

iter=getIter(dopants);
while(iter) {
  if ( getType(dopants[iter]) != "concentration" ) {
    reportError("Wrong quantity type"); break;
  }
  if ( getCharge(dopants[iter])==0 ) {
    iter++; continue;
  }
  add2NettoDoping(chargedDopants,iter++);
}

Example 3.9: break and continue statements



Robert Mlekus
1999-11-14