Nested array types

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Nested array types

mapp Services V5.16

The interpreter supports directly derived data types from an array as well as nested array types (arrays of arrays).

To access an element of the nested array type, multiple sets of indexing brackets are required, one for each "ARRAY [...] OF" specification, e.g. [...][...].

Example

TYPE
  ArrayType : ARRAY [1..10] OF DINT;
  MatrixType : ARRAY [1..10] OF ArrayType;   (* An array of arrays *)
  MultiType : ARRAY [1..10, 1..10] OF DINT;  (* A 2-dimensional array *)
END_TYPE
VAR
  Matrix : MatrixType;
  Multi : MultiType;
END_VAR
PROGRAM _MAIN
  Matrix[1][2] := Multi[1, 2];
END_PROGRAM