When iterating over an array you can use an indexed for loop, like so:
for (int i = 0; i < vectorSize; i++) {
e = element i of array
use e for something
}
but you can also use a loop that goes through each item in the array without using an index:
for (auto e : vector) {
use e for something
}
I've noticed that some languages support both types of loops, while some only use one or the other. What are the pros and cons of implementing the 'indexed' for loop as opposed to implementing a for-each loop?