Dim

Compilation

The Dim keyword is used to declare arrays or Unsigned integers at the beginning of a script.

Syntax

Dim tab_integ(<size>)
or
Dim tab_string$(<size>)
or
Dim unsigned_int As Unsigned

Parameters

<size>, numeric, size of the array starting at 0. Arrays are limited to one dimension and 65535 elements.

Remarks

Array variables MUST BE DECLARED AT THE VERY BEGINNING OF THE SCRIPT before being used. Functions/Subs declaration must be written 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.

See also

Program Structure

Data types

Example

 

dim my_array$(5) 'declares an array with 6 string elements.

my_array$(1)="test"

my_array$(2)="hello"

msgbox("1="+my_array$(1))

msgbox ("2="+my_array$(2))

 

dim my_array(100) 'declares an array with 100 integer elements (first element is my_array(0)).

 

dim my_pointer as unsigned