do...while
EVML do...while
statement creates a loop that executes a code block until the test condition evaluates to false
after each iteration. Therefore the statements within the code block execute at least once
Syntax
do {
statement
} while (condition);
Where...
statement
One or more statements executed at least once and executed each time the condition evaluates to true .
In EVML a code block of statements must be enclosed within curly braces ({...} ).
|
condition
A conditional expression evaluated after each iteration. If the condition evaluates to false the
loop is terminated and execution continues to following the do...while .
|
Example
The following example will output 1,2,3,4 and 5
<?ev
var i = 0;
do {
i += 1;
print(i);
} while (i < 5);
?>
The do...while
statement may persiste across multiple
<?ev..?>
script tags. The same example could be written as:
<?ev
var i = 0;
do {
i += 1;
?>
{{ i }}
<?ev
} while (i < 5);
?>