can u cancel arrays?

BlitzPlus Forums/BlitzPlus Beginners Area/can u cancel arrays?

mudcat(Posted 2005) [#1]
I've created an array, used it once ,now I don't need it anymore.Is there a way to get rid of it,or do I have to use something like this:
Create dim ship(19)
use it
now cancel
dim ship( )?

later,
mudcat


CS_TBL(Posted 2005) [#2]
Since you want to get rid of an array I assume you want to use this locally in a function? Try banks instead, they can be created and free'ed locally.

If not, why bother erasing it..? when you quit your app, blitz erases it all for you..


Beaker(Posted 2005) [#3]
For normal arrays use:
Dim ship(0)
..which makes it very small.

For 'Blitz arrays' use something like this:
Function blah()
	Local ship[19]
	;..do stuff to ships
End Function ; array is killed here

OR

Type arraycontainer
	Field ship[19]
End Type

ac.arraycontainer = new arraycontainer
;...
Delete ac



mudcat(Posted 2005) [#4]
Thanks Beaker,
That's just what I was looking for.
mudcat


Grey Alien(Posted 2005) [#5]
I use the array container method but what is this good for "Dim ship(0)". Surely you can't add anything to it or is it a dynamic length?


mudcat(Posted 2005) [#6]
Grey Alien,
what it is good for is to shrink ur array to smallest when ur done with it since u can't just cancle a standard arry.That's one of the answers to my question.