Jump to content

Array Length


Recommended Posts

Arrays in AutoIt use a 0-based index. That means the first element is #0. This then means that the index of the last element would be one less than the actual number of elements. Like so:

$array[0] = "first element"

$array[1] = "second element"

$array[2] = "third and last element"

Ubound($array) would return 3, the total number of elements. To access the 3rd element ($array[2]), you would use an index of 2, hence the -1.

Edit: typos

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...