/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//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(); }