Revision: 51929
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 7, 2011 19:09 by tuffstudio
Initial Code
//Mostly when people are writing loops, it looks like this:
for(var i:int = 0; i < list.length; i++)
{
var item:MyItem = list[i];
item.doSomething();
item.doAnotherThing();
}
//Take a look at the improved loop:
var item:MyItem;
var total:uint = list.length;
for(var i:uint; i < total; i++)
{
item = list[i] as MyItem;
item.doSomething();
item.doAnotherThing();
}
//Want a more freaky way to define the same optimized loop?
for(var i:uint, item:MyItem, total:uint = list.length; i < total; i++)
{
item = list[i] as MyItem;
item.doSomething();
item.doAnotherThing();
}
Initial URL
Initial Description
Initial Title
Optimized Loops
Initial Tags
Initial Language
ActionScript 3