Sign in to follow this  
Followers 0
qaravi

array error

4 posts in this topic

how can i solve the following error?

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

did i make mistake in declaring the array

thanks in advance

ravi_qa

Share this post


Link to post
Share on other sites

how can i solve the following error?

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

did i make mistake in declaring the array

thanks in advance

ravi_qa

Crystal ball says: "Maybe"

Hard to say where the mistake is with out a script to look at.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

how can i solve the following error?

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

did i make mistake in declaring the array

thanks in advance

ravi_qa

This error means you are trying to access an array element that has not been created (yet).

For instance, when you Dim $a[10] and then try to ConsoleWrite($a[10]) (or even higher than 10 ofcourse), you will get that error message. Important to know is that Dim $a[10] created an array $a with EXACTLY TEN elements, running from ZERO to NINE. Meaning: there is NO tenth element in this case; you would need an array with 11 elements for that.

This concept is called 0-based arrays (also called the 0-beast), and confusion about it is 9 out of 10 times the reason for this error.


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

Share this post


Link to post
Share on other sites

how can i solve the following error?

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

did i make mistake in declaring the array

thanks in advance

ravi_qa

#include <Array.au3>
dim $avArray[1] 
_ArrayDisplay($avArray, "_ArrayDisplay() Test")
$sValue = 1
ReDim $avArray[UBound($avArray) + 1]
$avArray[UBound($avArray) - 1] = $sValue
_ArrayDisplay($avArray, "_ArrayDisplay() Test")



$sValue = 2
ReDim $avArray[UBound($avArray) + 1]
$avArray[UBound($avArray) - 1] = $sValue
_ArrayDisplay($avArray, "_ArrayDisplay() Test")


$sValue = 3
ReDim $avArray[UBound($avArray) + 1]
$avArray[UBound($avArray) - 1] = $sValue
_ArrayDisplay($avArray, "_ArrayDisplay() Test")

$sValue = 4
ReDim $avArray[UBound($avArray) + 1]
$avArray[UBound($avArray) - 1] = $sValue
_ArrayDisplay($avArray, "_ArrayDisplay() Test")

صرح السماء كان هنا

 

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