Jump to content

Dynamic Arrays


Recommended Posts

Hi,

i'd like to do a number of things with Arrays dynamicaly.

i've tried a number of things & have read the help file a couple of times..

1. How do i create a blank array?

Do i just Dim it like i would any other variable? ie, when i use "_ArrayAdd" will it convert the variable to an array?

2. Will _ArrayAdd add to the array dynamically, w/o having to expand the array or w/o having to previously define the number of elements?

3. How do i access an element in an array?

is it $myElement = $myArray[$i]; (Where $i is the number of the array's element i wish to access)

Thanks.

Link to comment
Share on other sites

  • Developers

1. How do i create a blank array?

Do i just Dim it like i would any other variable? ie, when i use "_ArrayAdd" will it convert the variable to an array?

<{POST_SNAPBACK}>

Dim $Array[100]

2.  Will _ArrayAdd add to the array dynamically, w/o having to expand the array or w/o having to previously define the number of elements?

<{POST_SNAPBACK}>

Yes but just open the Helpfile for _ArrayAdd info....

3. How do i access an element in an array?

is it $myElement = $myArray[$i]; (Where $i is the number of the array's element i wish to access)

<{POST_SNAPBACK}>

Correct...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

ok, i seem to have it under control now.

my problem was i was trying to Dim the array with 0 elements "Dim myArray[0]"

it's anoying that we can't just create a blank array.

so my hack for it was:

Dim $myArray[1]

... add elements dynamically (which add from element 1 onwards) ...

then start the retrieval loop from element 1 instead of 0

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...