The while statement creates a loop that executes a code block so long as a condition evaluates to true. The condition is evaluated before executing any statements within a code block.


    while (condition) {


condition A conditional expression evaluated before each iteration of the while loop. If this condition evaluates to true the statement within the code block is executed.
statement One or more statements executed as long as the condition evaluates to true. The code block must be enclosed with curly braces ({ ... }).

Try it out

The following example demonstrates how the while statement may be distributed across two <?ev..?> script blocks. 

    var i=0;
    while(i++ < 5){
    <p>Hello {{ i }}</p>
<?ev } ?>