Arrays in structures.

We have seen that structures can be defined as arrays using the TDIM() function. But what about having one element of the structure being an array of values? PPL offers a transparent way to do just this using the DIM() function. It will create an array from Lets first start by defining our variable structure:

struct(s$, "a", "b");

Now lets dimension our element, in our case we will use s.a$:

dim(s.a$, 10);
s.a$[0] = 1;
s.a$[1] = 2;
s.b$ = 3;
ShowMessage(s.a$[0] % "," % s.a$[1] % "," % s.b$);

You can even use strings with your array element, don't forget to use the @ operator to convert array elements to string since they only point to a pointer:

s.a$[2] = "Hello World!";
ShowMessage(@s.a$[2]);

As you see, structures are very flexible and quite efficient too. They can support multiple type of data, even arrays of double type values and even strings.