best-practice on for loop's condition
- by guest
what is considered best-practice in this case?
for (i=0; i<array.length(); ++i)
or
for (i=array.length(); i>0; --i)
assuming i don't want to iterate from a certain direction, but rather over the bare length of the array. also, i don't plan to alter the array's size in the loop body.
so, will the array.length() become constant during compilation? if not, then the second approach should be the one to go for..