Skip to main content

WHILE

WHILE creates a loop that continue to repeat whilst the given <condition> is TRUE.

Also supports an optional parameter for a new variable that keeps count of the current iteration, which is zero based.

Syntax

WHILE <optional: count declaration>,<condition>
<codeblock>

DucklingScript

VAR a 10
WHILE a!=15
VAR a a+1
$STRING a

Compiled

STRING 11
STRING 12
STRING 13
STRING 14
STRING 15
warning

Please note that there is a limit to while loops; while loops will eventually error if they run too many times.