Recently I’d been criticized for structuring my for loops like so:
var i:MovieClip;
for each(i in array)
{
// be awesome
}
Or,
var i:uint = 0;
for(i; i<10; i++)
{
// be more awesome
}
This reads better for me personally, yet I’m being attacked for it. Is there any difference?
Old Answer
Yes: The way you’re doing it, the variable lives on after the loop ends. Making sure the variable doesn’t exist outside of the scope of the loop ensures that you never accidentally refer to it outside the loop.
Update:
At least that’s how most languages do it. However, in ActionScript the for loop variable is in the scope of the parent! So there really is no difference in ActionScript.