Guest Ultima Posted March 28, 2005 Share Posted March 28, 2005 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 More sharing options...
therks Posted March 28, 2005 Share Posted March 28, 2005 Nope. Only thing you can do is something like with StringSplit... $array = StringSplit('Value 1,Value 2,Value 3', ',') Or something similar. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
SlimShady Posted March 28, 2005 Share Posted March 28, 2005 (edited) 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 Next Edit: Or as Saunders mentioned. Method 3. $Array = StringSplit("1,2,3", ",") Edited March 28, 2005 by SlimShady Link to comment Share on other sites More sharing options...
Guest Ultima Posted March 28, 2005 Share Posted March 28, 2005 Thanks, I like the StringSplit method. Link to comment Share on other sites More sharing options...
Klaatu Posted March 28, 2005 Share Posted March 28, 2005 Or use the included Array.au3 file function _ArrayCreate: #include "Array.au3" Dim $Array = _ArrayCreate(1, 2, 3) My Projects:DebugIt - Debug your AutoIt scripts with DebugIt! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now