Jump to content

how to declare array with pre-initialized values?

Guest Ultima

Recommended Posts

Guest Ultima

I want to declare an array with some pre-initialized values like

int Array[3] = {1, 2, 3}

Is there anyway to do it in AutoIt?

Link to comment
Share on other sites

The correct syntax in AutoIt:

Method 1.

Dim $Array[3]
$Array[0] = 1
$Array[1] = 2
$Array[2] = 3

Method 2.

Dim $Array[3]
For $i = 0 To 2
   $Array[$i] = $i + 1


Or as Saunders mentioned.

Method 3.

$Array = StringSplit("1,2,3", ",")
Edited by SlimShady
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...