Jump to navigation Jump to search
The DIM statement is used to declare a variable type or dimension an array.
- Syntax 1: DIM variable AS type
- Syntax 2: DIM Array(elements) AS type
- Syntax 3: DIM Array(elements)
- Uses the AS keyword to define a variable or array type as INTEGER, LONG, SINGLE, DOUBLE or STRING.
- QB64 can also use _BIT, _BYTE, _INTEGER64 or _FLOAT variable types.
- Can set the range of elements(indices) of an array.
- When the $DYNAMIC metacommand is not used, array sizes are unchangeable($STATIC).
- Use REDIM instead of DIM to dimension arrays as dynamic without the $DYNAMIC metacommand.
- Can also DIM variables as SHARED for sub-procedures to have access to them.
- All types can be dimensioned as _UNSIGNED, or positive only, in QB64.
Example 3: DIM Image%(2000) ' dimensions array without determining the type