1C:Enterprise features a universal method for iterating collections: the "For each" iterator. You can use it for iterating most of the collections. The iterator allows recording all collection elements to a specified variable, one by one.
For some collections, you can get collection elements by their numeric indexes. You can iterate such collections both by using iterators and by using indexes. An example of such collection is Array.
However, for some collections you cannot get collection elements by indexes because the elements are not ordered. In such cases the "For each" iterator helps iterate the collection. Note that the iteration order should not be interpreted as the order of collection elements. When you use the "For each" iterator on an unordered collection, the resulting iteration order is generally unpredictable. Therefore, building your collection processing algorithms based on iteration order is not allowed. An example of such collection is Map.
It is important to remember that the iteration order might change unpredictably after adding or removing collection elements. This behavior can vary between collections. Therefore, it is recommended that you do not add or remove collection elements while "For each" iterating is being performed. If you need to add or remove elements, we recommend that you use indexes, or mark elements to delete them later, after the iterating is complete.