VBS TUTORIAL: VBScript statement-erase statement _vbs

Source: Internet
Author: User

Erase statement

Reinitialize the elements of a fixed-size array and release the storage space for the dynamic array.

Erase array

The array parameter is the name of the array variable to clear.

Description

It is important to determine whether an array is a fixed-length array (regular) or a dynamic array, because Erase to perform different operations based on the type of the array. Erase eliminates the need to restore memory for fixed-size arrays. Erase Sets the elements of a fixed array according to the following table:

The
type of arrayeffect of Erase on fixed array elements
Fixed numeric array Set each element to 0.
Fixed string array Set each element to a zero-length string ("").
Array of objects Set each element to a special value of nothing.

Erase frees the memory used by the dynamic array. Before the program references the dynamic array again, you must use the ReDim statement to redefine the dimension of the array variable.

The following example illustrates how to use the Erase statement.

Dim NumArray(9)     Dim DynamicArray()ReDim DynamicArray(9)  'Allocate storage space. Erase NumArray ' each element is reinitialized. Erase DynamicArray 'frees the memory occupied by the array.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.