erase
Erase arrays and their content.
Syntax:
erase array[]
erase array[ ... ]
If no indexes are specified, erases all the array. For static arrays, this means resetting all the values to zero. For dynamic arrays, this means deleting all the keys and and values. For example:
dim a[10] '<------------ Create a static array
' Initialize it
for i = 1 to 10
a[i] = i
end for
erase a[] '<------------- Reset it to zeros
If indexes are given, only the specified index will be reset. For static arrays, this is the same as setting the value to zero:
dim a[10] '<------------ Create a static array
' Initialize it
for i = 1 to 10
a[i] = i
end for
erase a[3] '<------------- Same as a[3] = 0
On the other hand, if the array is dynamic, the key and value are actually removed, so the array shrinks:
Dim a[] '<------------- Create a dynamic array
' Initialize it
for i = 1 to 10
a[i] = i
end for
erase a[3] '<------------- Remove element from array
See also dim command.