Usage
The Dim
function declares arrays or Unsigned integers at the beginning of a script.
Syntax
Dim tab_integer(<size>)
or
Dim tab_string$(<size>)
or
Dim unsigned_int As Unsigned
Parameters
<size>
: integer, constant. Only one-dimensional arrays are supported. The indexes of the array elements range from 0 through<size> - 1
. Maximum size is 65534.
Remarks
Array variables MUST BE DECLARED AT THE VERY BEGINNING OF THE SCRIPT before being used. Functions/Subs declaration must be inserted after arrays declaration. If Included scripts are used, the structure of the full long script with the inclusions must follow the same order: first arrays, second functions/subs, third main program.
Examples
Dim my_array$(5) ' Declare an array with 6 string elements.
my_array$(0) = "test" ' Initialize first element.
my_array$(1) = "hello" ' Initialize second element.
msgbox("First element contains: " + my_array$(0))
msgbox("Second element contains: " + my_array$(1))
Dim my_array(100) ' Declare an array with 101 integer elements (first element is my_array(0)).
Dim my_pointer As Unsigned ' Declare an unsigned integer (a pointer).