Array and Enumeration in Structured Text

What is an array:

An array can be defined as an ordered collection of items indexed by contiguous integers. An array is a data structure that can store a number of variables of the same data type in sequence. These similar elements could be of type int, float, double, char,  Function Block etc.

Arrays are used when there is a need to use many variables of the same type. It can be defined as a sequence of objects which are of the same data type. It is used to store a collection of data, and it is more useful to think of an array as a collection of variables of the same type. Arrays can be declared and used. A programmer has to specify the types of elements and the number of elements that are required by an array. This is called a single-dimensional array. The array size should be an integer constant and greater than zero.

One-, two-, and three-dimensional fields (arrays) are supported as elementary data types. Arrays can be defined both in the declaration part of a POU and in the global variable lists.