Sign in to follow this  
Followers 0
Enivid

Declare 2D array with pre-initialized values

5 posts in this topic

Is there a way to declare a 2D array with pre-initialized values using arrays.au3?

Thanks

Share this post


Link to post
Share on other sites



No. The Array Create function from array.au3 shouldn't be used anymore anyways. Use the functionality that is built into the syntax of the language for declaring filled arrays.

Share this post


Link to post
Share on other sites

Is there a way to do it at all then? In the help file I only see examples of filling up a multi dimensional array one value at a time.

Share this post


Link to post
Share on other sites

Is there a way to do it at all then? In the help file I only see examples of filling up a multi dimensional array one value at a time.

You can declare an array and set initial values at the same time as shown in the help for Dim. Is that what you mean?

To initialize an array, specify the values for each element inside square brackets, separated by commas. For multiple dimensions, nest the initializers. You can specify fewer elements in the initializer than declared, but not more. Function calls can also be placed in the initializers of an array. If the function call returns an array, then the one array element will contain that returned array.

Dim $Array1[12]=[3, 7.5, "string"], $array[5] = [8, 4, 5, 9, 1]

Dim $Grid[2][4]=[["Paul", "Jim", "Richard", "Louis"], [485.44, 160.68, 275.16, 320.00]]

Dim $Test[5] = [3, 1, StringSplit("Abe|Jack|Bobby|Marty", "|"), Cos(0)]


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thats it, thanks

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