Jump to content

Array Declaration


Recommended Posts

Hi again!

I've been having serious issues with Dim. See, I have a variable and I don't know what it is and I need to use that variable to specify the length of an array. Only it says "Array variable subscript badly formatted." Here is the code:

Dim $a[Int($b + 1)]

I want to do that so I wouldn't have to do...

Dim $a[1001]

...and use up resources and hope that when i'm writing to the array that $b doesn't exceed 1000.

Help! :)

Edited by erifash
Link to comment
Share on other sites

Yes, but $b is a decimal like 3.14159265 (not pi though, just example) so that's why I thought it being a non-interger screwed it up so I made it and interger by using Int().

Also, it still doesn't work... (see screenshot)

Edited by erifash
Link to comment
Share on other sites

its your $b

This runs:

$b = 3.14159
Dim $a[int($b+1)]

$a[int($b)] = "hi"
msgbox(0,"",$a[int($b)])

EDIT

If your $b <= -1 it will break like it is for you, you probably need to add:

int(abs($:)+1)

Edited by Ejoc
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
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...