while (condition) {
statement1;
statement2;
...
}
The while statement checks the condition, and if it’s true, executes the block, then repeats. As long as the condition is true, the block continues to execute.
float $test = 0;
while ($test < 5) {
print("$test equals: " +$test+"\n");
$test = $test + 1;
}
This example prints the following lines in the Script Editor:
$test equals: 0
$test equals: 1
$test equals: 2
$test equals: 3
$test equals: 4