Dynamic array

<< Click to Display Table of Contents >>

Navigation:  Reference >

Dynamic array

Rather than defining a constant size, you can add the keyword Array after any primitive type to create a dynamic array.

For example, the following declaration is allowed:

Var 

   Fader1, Fader2, Fader3, Fader4 : Widget

   Faders : Widget Array

 

Initialization

   Faders = [Fader1, Fader2, Fader3, Fader4] // Array initialization

End

 
or more conveniently:

Var 

   Fader1, Fader2, Fader3, Fader4 : Widget

   Faders : Widget Array = [Fader1, Fader2, Fader3, Fader4]

 
Then you can use array indices to reference individual widgets. The size function works as expected and will return the current size of the array which of course is 4 in the above example.

Currently allowed array types include all the types (integer, string, boolean, double, MidiMessage, Widget) and the three parameter types, Subrange, Discrete and Continuous.

The empty array [] can be used to clear the contents of a dynamic array.

Var 

   x : Integer Array = [1,2,3,4]

Initialization

   x = []

End