A foreach loop can be terminated in the following ways.
All iterable entries have been accessed
A break or return instruction is executed