Erase Command

Purpose

Deletes all arrays listed after it.

Syntax

Erase x1() [,x2(),...]

x1(),x2(),...:arrays of any type

Description

The arrays in the list after Erase must be separated by commas.

Example

OpenW # 1

Dim a#(5), b%(3), i%

ArrayFill a(), PI

ArrayFill b%(), 42

Mat Print a()

Print

For i% = 1 To 3

Print b%(i%)

Next i%

Erase a(), b%()

Try

Print b%(2)    // Array bounds exceed error

Catch

Print "Array Bounds Error - b%(2) no longer exists"

EndCatch

Remarks

Erase clears all elements of the array from memory but does not delete the array reference; this is cleared for local variables when the procedure is exited, and for global variables when the program ends. For this reason, Erase can be used to clear all values from an array before ReDim-ing it.

See Also

Clr, Dim, Redim

{Created by Sjouke Hamstra; Last updated: 04/10/2014 by James Gaite}