...

/

Iterating Over a Vector

Iterating Over a Vector

This lesson will teach you how to loop through a vector.

If it is desired to access each element of a vector, then it is possible to iterate over the elements of a vector using iter() rather than using the indexes to access a particular element of a vector using the square bracket notation.

Iterate Using .iter() Built-in Method

In the previous lesson, we learned to remove an element given an index. However, to remove a particular element, we first need to find the index of that element and then call the ...