A faster way to write a for loop. It caches the array size, so we don't need to recalculate the size at every iteration.