How can I slice an array so it's empty?

BlitzMax Forums/BlitzMax Beginners Area/How can I slice an array so it's empty?

So like I'm a bit noob with slicin' and I've seen this to grow an array:

Local out[]
out=out[..Len(out)+1]


So how can I reset out back to an "empty" array of no slots (in a memory leak safe way) please? Thanks.

out=out[..0]?

out:Int=New Int[0]

(Obviously the array out needs to already exist)

so simonh, does yours work? I never tested it...
H&K fair enough, could shorted to New Int[] I believe?

out=Null?

or do you need it to still think an array is defined?

so simonh, does yours work? I never tested it
You lazy git!
Local out[10]
Print Len(out)
out = out[..0]
Print Len(out)


AngelD: yeah still need it to be an array.

You lazy git!
lol, I had to go an eat dinner when I saw Simon's solution. no time, so busy etc ;-)