9.9. Using Array Mixed Mode

[<<<] [>>>]

Once you will reach a point when you want to use an array in a mixed indexed mode. For example you want to handle an array of associative arrays. In other words you want to have an array, of which each element is an array itself.

For example you want to store the phone number, the room number and the name of the dog for each of your employee. You have 78 employees in your firm. In this case you need an array having 78 elements, each element being an associative array itself, with the keys "phone", "room", "dogname".

To do this you can

FOR I=1 to 78

PRINT I,". ",EMPLOYEE[I]{"phone"}," ",EMPLOYEE[I]{"room"},_ " ",EMPLOYEE[I]{"dogname"},\n" NEXT I

You can mix the indices any order in any deepness. For example


is correct. What you can use it for is another question though.

Note that


is almost the same as


but the latter is a bit more efficient (due to ScriptBasic internal algorithms). The details on differences can be read in the section Reference Variables.

[<<<] [>>>]