Setting different vars in for loop?
Hi
I have a reasonable large loop, and I want it to loop one of two ways depending on conditions before it...
1. for (var i:int = searchHit; i< array.length; i++)
or
2. for (var i:int=array.length; i>=0; i--)
I'm wondering if there is a way to set up vars to populate the above to avoid writing out two identical oops with different conditions?
I can do this...
var _inc = "++" (or "--") depending on previous code
var _range = array.length;
for (var i:int = _range; i< array.length; i[inc])
...but I'm unsure how to put i< array.length or i>=0 into a var to insert (or if it's even possible)?
Thanks for your help.
