do...while

 
 
 

A do loop has this form:

do {
	statement;
	statement;
	 ...
} while (condition);

Unlike the while loop, a do...while loop checks the condition at the end of each cycle. The block will execute at least once. The loop terminates when condition is false.

float $test = 0;
do	{
	print("$test equals: " +$test+"\n");
	$test = $test + 1;
	} 
while ($test < 5);

This prints the following lines in the Script Editor:

$test equals: 0
$test equals: 1
$test equals: 2
$test equals: 3
$test equals: 4