The for
statement repeatedly executes the same block of statements as long as a
stated test condition, based upon a counting mechanism, remains
true.
A counting variable is created
that allows the for loop to execute (iterate) a specified number
of times. As long as the test condition remains true, for each
iteration of the counter, the block of statements is executed. The
first time that the test condition returns false, the for
loop is terminated, the block of statements is not executed, and the
program jumps to the first line of code (if any) after the for
loop.
The test condition is defined using
three optional expressions.
<?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>
for
example
</p>
<do type="accept">
<go
href="ForExample.wmls#findfor()" />
</do>
</card>
<card id="card2">
<p>
for loop is over
</p>
</card>
</wml>Code for ForExample.wml
extern function findfor()
{
var end = 95;
for(var count=0; count < end;
count++;)
{
// You can place any code you
desire here
}
WMLBrowser.go("ForExample.wml#card2");
};
Code for ForExample.wmls