Erase statement
Reinitialize elements of a fixed-size array and release the storage space of the dynamic array.
EraseArray
ArrayThe parameter is the name of the array variable to be cleared.
Description
It is important to determine whether an array is a fixed-length array (regular) or a dynamic array, becauseEraseYou must perform different operations based on the array type.EraseYou do not need to restore memory for an array of fixed sizes.EraseSet Fixed Array elements as follows:
Array type |
Effect of erase on Fixed Array elements |
Fixed value Array |
Set each element to 0. |
Fixed String Array |
Set each element to a zero-length string (""). |
Object Array |
Set each element to a special value of nothing. |
EraseReleases the memory used by the dynamic array. InProgramBefore referencing the dynamic array again, you must useRedimStatement to redefine the dimension of the array variable.
The following example illustrates how to useEraseStatement.
Dim numarray (9) dim dynamicarray () redim dynamicarray (9 )'
Allocate a bucket.EraseNumarray'
Each element is reinitialized.EraseDynamicarray'
Releases the memory occupied by the array.