Arrays of structures.

There comes a time when you need to store a series of data in the same format. Storing values in a structure will help clarify your code and your programming task as well. However, you might want to store more of the same data in multiple structures. This is where arrays of structures become very handy.

Lets first define our structure variable format:

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

Next we will make this structure an array but keeping the structure information at the same time. Notice we use TDIM() and not the regular DIM() function? The TDIM() function is a special function that can be used with structures only.

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

Arrays of structures are very ressemblant to lists of structures but offers an a great alternative is lists are too complicated for you.