If I have the following AS3 code inside of a class:
public function doStuff():void
{
for (var i:uint = 0; i < myArray.length; i++)
{
// do stuff
}
for (var i:uint = 0; i < myArray.length; i++)
{
// do stuff
}
}
I get a “Duplicate variable definition” compiler complaint. Obviously I could declare the i variable once within the function call to avoid the issue, but I shouldn’t have to. The first i should be out of scope before the second for loop begins. Any ideas?
Thanks,
~JC