Wiki source for KeyPgErase


Show raw source

{{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.

{{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"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode