Skip to content

Container data types

We often need not just one piece of information, but many related entries. This could be a vector, for example. If we were to save a vector as a single variable, it would look like this:

x = 1
y = 2
z = 3

This would mean that you would have to manage several entries every time this vector is used, which would make the code far too confusing. Just imagine if you wanted to store not just the coordinates of one particle, but many particles: then individual variables would have to contain a sequential number, for example.

To avoid this, there are container data types that summarise several individual values. The individual data types have different properties, making them differently suitable for certain applications. It is therefore important to know the differences between them.

Container data types are often summarised as iterables (iterable containers), as the individual elements are regularly accessed by means of a loop.