Mel - Maya Embedded Language

while

The while loop runs a command while the test condition holds true
A while loop mainly consists of:

while (test condition;) {operation;}

string $myArray [] = {"one","two","three","four"};
int $i =0;
while ( $i < size($myArray))
{
	if ($myArray[$i] == "one")
		print ("\n"+$myArray[$i] + " dead roach!");
	else
		print ("\n"+$myArray[$i] + " dead roaches!");
$i++;//do not forget this or Maya will get stuck in an infinite loop
}
returns:

one dead roach!
two dead roaches!
three dead roaches!
four dead roaches!