STATEMENT:  continue

continue
 
The continue statement is used to stop the execution of a block of statements inside a for or while loop statement.
 
It is important to understand that the continue statement does not cause the program to exit the for or while loop statement, but rather, the program is redirected inside the loop. All processing is immediately stopped inside the block of statements. In a while loop, the program jumps to the while condition test. In a for loop, the program jumps to the for counting variable test expression.
 
Attempting to use a continue statement outside of a for or while loop statement will generate an error.
 
Code for ContinueExample.wml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   continue example
   </p>
   <do type="accept">
      <go href="ContinueExample.wmls#findcontinue()" />
   </do>
</card>

<card id="card2">
<p>
   count reached $(count)
</p>
</card>

</wml>

 
Code for ContinueExample.wmls
extern function findcontinue()
{
   var count = 0;
   while(count < 10)
   {
   var rand = Lang.random(10);
      if(rand > 5)
      {
         count++;
         continue;
      }
      if(rand < 5)
      {
         count--;
         continue;
      }
      if(rand == 5)
      {
         break;
      }
   }
   WMLBrowser.setVar("count", count);
   WMLBrowser.go("ContinueExample.wml#card2");
};

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information