{{fbdoc item="title" value="ERASE"}}----
Statement to erase arrays

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Erase** ( array [[KeyPgAs|as]] [[KeyPgAny|any]] [, ... ] )
##
{{fbdoc item="usage"}}##
	**Erase**( //array0// [, //array1// ... //arrayN// ] )
##
{{fbdoc item="param"}}
	##//array//##
		An array to be erased.

{{fbdoc item="desc"}}
	Using ##**Erase**## on a fixed-length array resets all elements without freeing the allocated memory.
	In case of objects, there is destruction then re-construction.
	
	Using ##**Erase**## on a variable-length array (array already sized) frees the memory allocated for the array elements, but the array remains declared at its same scope level (with the same datatype and number of dimensions).
	In case of objects, there is destruction before freeing memory.
	
	**Note:** ##**Erase**## can not be used on fixed-size arrays passed as parameters in a procedure. FreeBASIC can not prevent you from trying this at compile-time, but the results at run-time will be undefined (up to crashing).

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/array/erase.bas"}}%%(freebasic)
dim MyArray1(1 to 10) as integer
redim MyArray2(1 to 10) as integer 

erase MyArray1, MyArray2
%%

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- ##[[KeyPgCommon|Common]]##
	- ##[[KeyPgDim|Dim]]##
	- ##[[KeyPgExtern|Extern]]##
	- ##[[KeyPgLbound|Lbound]]##
	- ##[[KeyPgRedim|Redim]]##
	- ##[[KeyPgStatic|Static]]##
	- ##[[KeyPgUbound|UBound]]##
	- ##[[KeyPgVar|Var]]##

{{fbdoc item="back" value="CatPgArray|Array Functions"}}