# Array Help

## Recommended Posts

Is it possible to create arrays where the array number is a variable? For example, \$var[\$count] = 1. But that says badly formatted array.

##### Share on other sites

Is it possible to create arrays where the array number is a variable? For example, \$var[\$count] = 1. But that says badly formatted array.

You have to create the array first, and the number must be there...

#include <array.au3>
Dim \$var[3]
\$count = 2
\$var[\$count] = 1
_ArrayDisplay(\$var)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

Is it possible to do it without creating the array first? I need this to create an infinite number of arrays if needed. So i cound just have \$count increase rather than have to define arrays if they are not needed.

##### Share on other sites

Is it possible to do it without creating the array first? I need this to create an infinite number of arrays if needed. So i cound just have \$count increase rather than have to define arrays if they are not needed.

No not really, even _ArrayCreate() has to create the array first.. might take a look at Eval() ...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

Is it possible to do it without creating the array first? I need this to create an infinite number of arrays if needed. So i cound just have \$count increase rather than have to define arrays if they are not needed.

Maybe it's an idea to explain a bit more what you need these Infinite Numbers of Arrays for; there might be a better approach to what you are trying to accomplish.

As Einstein said: the need for infinities in calculations often imply the use of too many dimensions. Or something along those lines, anyway...

Roses are FF0000, violets are 0000FF... All my base are belong to you.

##### Share on other sites

Is it possible to do it without creating the array first? I need this to create an infinite number of arrays if needed. So i cound just have \$count increase rather than have to define arrays if they are not needed.

Hi,

Not sure what you mean.. if you mean you can reuse the same array name with a different number of elements each [infinite numbers of.. ] time you use that array name, then each time , just

"redim \$ar_Array[\$i_Count]" to give it the correct size

Best, randall

## Create an account

Register a new account