while. Loop with condition

^while(condition){body}
^while(condition){body}[delimiter]   
[3.1.5]
^while(condition){body}{delimiter}   
[3.1.5]

Operator
while repeats the body while condition is true. If provided condition is initially false, the body will not be executed at all.

Delimiter is string or code to be implemented before every non-empty body, except the first.

You can force finish the loop using break operator or finish current step and go to next one using continue operator. [3.2.2]

Example

<h2>TEN FAT SAUSAGES</h2>
$sausages(10)
^while($sausages > 0){
    <p>$sausages fat sausages sizzling in a pan<br />
    $sausages
 fat sausages sizzling in a pan<br />
    One went pop!<br />
    and the other went bang!<br />
    ^sausages.
dec(2)
    There were $sausages fat sausages sizzling in a pan</p>
}[
<br />]


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 21.09.2007