for...each...in loop. Can I make assumptions about the order?
i've assumed can't make assumptions order in elements indexed for...each...in loop. not conventional indexed array. (emphasis!: i'm not talking associative arrays here, i'm talking normal indexed arrays. dense, no gaps.).
for each (var element:elementclass in myarray) {}
may not traverse array first last. i've never assumed it's guaranteed anyway. neither ecma standard. assume compiler/runtime @ liberty index array in order, may different each time.
whereas... (var i:int=0;i<myarray.length;i++) {......var element:elementclass=myarray[i]....}
....is guaranteed traverse array first last. use looping statement if ordering important.
my question is.... in actionscript 3, can assume for..each..in traverse dense indexed array first last?
actually, specific case @ moment programmer passing me array,assembled within for...each..in loop. need assume order of array. if going work in actionscript3, no problem. although i'll continue worry ecma standard own code, , wont make assumptions ordering - won't force anal-retentive programming style on other guy.
yes, can assume order.
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment