Arrays, Tuples, and Records
1-Dimensional Arrays –
1-dimensional arrays are a finite ordered set of elements of the same type. This means that there is always a specific number of elements in the array, the array begins at index 0, and all elements are of the same structure, such as string or integer.
Example –
2-Dimensional Arrays –
2-dimensional arrays are arrays that can be visualised as tables, where data can be grouped. This also continues to be true for any array with dimensions greater than 1.
Example –
Tuples –
Tuples are ordered sets of elements of any type, this means that the elements do not have to be of the same data structure, so you can have both strings, integers, and floats in the same tuple. Tuples are also immutable, meaning they cannot be dynamically edited. Once a tuple is defined in a program, its data cannot be changed.
Records –
Records contain multiple fields, each containing data about the same subject. Records are permanent and are used to store data in databases or spreadsheets, think of an excel spreadsheet, and how each row contains data about the same subject, perhaps a person, each of these rows is a record.