The most common use of a for loop is to iterate over every element of an array. MEL has a special form of the for loop that lets you do this very easily.
for (array-element in array) { statement; statement; ... }
string $carType[3] = {"Porsche", "Ferrari", "BMW"}; string $car; for ($car in $carType) { print("I want a new "); print($car + ".\n"); }
This prints the following lines in the Script Editor:
I want a new Porsche. I want a new Ferrari. I want a new BMW.
The loop executes three times, once for each array element in $carType.