| .REDIM Statement Details. |
|
  QuickSCREEN       Details       Example       Contents       Index |
| ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ |
| REDIM Statement Details |
|
| Syntax |
|   REDIM [SHARED] variable(subscripts)[AS type] |
|                  [,variable(subscripts)[AS type]]... |
|   |
|   Arguments    Description |
|   SHARED       The optional SHARED attribute allows a module to share |
|                variables with all the procedures in the module; this |
|                differs from the SHARED statement, which affects only |
|                the variables within a single module. SHARED can only |
|                be used in REDIM statements in the module-level code. |
|   variable     A BASIC variable name. |
|   subscripts   The dimensions of the array. Multiple dimensions can be |
|                declared. The subscript syntax is described below. |
|   AS type      Declares variable as an elementary or user-defined |
|                type. The elementary types are INTEGER, LONG, SINGLE, |
|                DOUBLE, and STRING. |
|   |
| Subscripts in REDIM statements have the following form: |
|   |
|   [lower TO] upper [,[lower TO] upper]... |
|   |
| The TO keyword provides a way to indicate both the lower and the upper |
| bounds of an array's subscripts. The arguments lower and upper are numeric |
| expressions specifying the lowest and highest value for the subscript. |
See the DIM statement details for more information about using the |
| TO keyword. |
|   |
| The REDIM statement changes the space allocated to an array that has been |
| declared $DYNAMIC. |
|   |
| When a REDIM statement is compiled, all arrays declared in the statement |
| are treated as dynamic. At run time, when a REDIM statement is executed, |
| the array is deallocated (if it is already allocated) and then reallocated |
| with the new dimensions. Old array-element values are lost because all |
| numeric elements are reset to 0, and all string elements are reset to null |
| strings. |
|   |
|   Note: Although you may change the size of an array's dimensions with |
|         the REDIM statement, you may not change the number of dimensions. |
|         For example, the following statements are legal: |
|   |
|           ' $DYNAMIC |
|           DIM A(50,50) |
|           ERASE A |
|           REDIM A(20,15)    'Array A still has two dimensions. |
|   |
|         However, the following statements are not legal, and produce |
|         an error message that reads "Wrong number of dimensions": |
|   |
|           ' $DYNAMIC |
|           DIM A(50,50) |
|           ERASE A |
|           REDIM A(5,5,5)   'Changed number of dimensions from |
|                            'two to three. |