Jump to content

Recommended Posts

Posted

ciao, sono nuovo del forum e cerco aiuto sull'argomento array:

la mia esigenza è assegnare un valore ad un elemento di una array multidimensione; mi spiego con un esempio:

ho definito la seguente array:

DIM $TAB1[2][10]

questa ha 2 dimensioni, vero ?

COME FACCIO AD ASSEGNARE il VALORE 3 ALL'ELEMENTO [2] [1] ?

ho usato questa istruzione:

$TAB1[2][1] = 3

ma ricevo il seguente errore:

==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

in altri linguaggi questa sintassi è corretta

grazie

Posted (edited)

LOL, which in English (from Italian) is:

hello, I am new the forum and look for help on this array:

My requirement is to assign a value to an element of an array multidimensione; me explain with an example:

I defined the following array:

DIM $ TAB1 [2] [10]

this has 2 dimensions, right?

HOW DO I ASSIGN the value 3 to the [2] [1]?

I used this instruction:

$ TAB1 [2] [1] = 3

but I get the following error:

==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:


other languages in this syntax is correct

thanks

Assuming you're using this (because the extra spaces would definitely break it):

DIM $TAB1[2][10]

$TAB1[2][1] = 3

Your issue is you need to declare your array one higher than what you plan on using. So to be able to go $Tab1[2][1], you'd need to declare Dim $Tab1[3][10], not Dim $Tab1[2][10]

Edited by exodius
Posted

OK... i'have forget the element ZERO that is always present for any array... thank's

p.s. excuse me for the missing english translation of my message...

Posted

OK... i'have forget the element ZERO that is always present for any array... thank's

p.s. excuse me for the missing english translation of my message...

LOL, no worries, just had to put it in a language I understood before I could help you with it... Gotta love Google Translate though. :)

The zero element is a peculiar one in implementation, a lot of the built in functions set that element to contain the # of elements in the array, but AutoIt doesn't do this as a language when you create your own... So you can sure still use tho zero function, just make sure your array is always one larger than you're currently using. :)

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
×
×
  • Create New...