Sign in to follow this  
Followers 0
MonsieurOUXX

How to create empty arrays? How to delete arrays?

7 posts in this topic

Hi all,

I have 2 questions :

1/ I don't know how to create an array that contains zero elements at first.

the code below is invalid :

Local $array[0]

the code below doesn't produce any output :

Local $array
_ArrayAdd($array, "1")
_ArrayAdd($array, "2")
_ArrayDisplay($array)

2/ I don't know how to delete an array

I'd like to remove all the contents of an array at once to make it brand new.

Share this post


Link to post
Share on other sites



1 - For what? (It is impossible)

2 - I use ReDim:

#include <array.au3>

Dim $array[10]

$array[0] = 5

$array[8] = 7

_ArrayDisplay($array)

ReDim $array[1]

$array[0] = ""

ReDim $array[10]

_ArrayDisplay($array)

Share this post


Link to post
Share on other sites

1 - For what? (It is impossible)

For...pretty much everything! (it is a nonsense to have an array that HAS to contain something when created - it's possible in most other languages)

2 - I use ReDim:

Cool, thanks.

Share this post


Link to post
Share on other sites

i use something like this to make empty arrays, not sure if thats what you are looking for

you'll just have to delete empty array at the end or you'll have a blank at the top

Dim $Array[1][2] = [[""]]

Share this post


Link to post
Share on other sites

i use something like this to make empty arrays

Dim $Array[1][2] = [[""]]

Interesting. Thanks!

Share this post


Link to post
Share on other sites

Interesting. Thanks!

It's unnecessary because when an array is created all the elements are set to '' without you having to do anything.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0