erase data inside an array

hi,

Please assist how can we erase the data and elements inside an array?

Thanks.
RyanBankAsked:
Who is Participating?
 
basicinstinctConnect With a Mentor Commented:
Use this command (where arr is the name of your array):

Erase arr
0
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
the ERASE completely removes the array.

if you use the following, you empty all the array values:
REDIM yourarray(<size>) as <data type>

0
 
basicinstinctCommented:
Here's website that talks about the Erase command: http://www.html.dk/dokumentation/vbscript/HTML/vsstmErase.htm#vsstmerase

By the way, if you totally want to kill the array you can use this command:

arr = Nothing


0
 
basicinstinctCommented:
Well, to clarify Angel's comment

Erase only completely removes dynamic arrays.  In the case of static arrays it empties all of the data values (sets them to default for that data type).
Also, I do believe you can only use redim on a dynamic array.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.