Opened on Oct 14, 2013 at 10:18:37 AM
Closed on Dec 2, 2013 at 9:24:36 PM
#2505 closed Feature Request (Duplicate)
Array create without declaration
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | Cc: |
Description
Local $aData = ['p','e','t'] ;OR _my(['p','e','t']) Func _my($aD) ;... EndFunc ;OR Local $aData[1][3] ;create array $aData[0] = ['p','e','t'] ;fill the first element ;must be the same as ;Local $aData[1][3] ;$aData[0][0] = 'p' ;$aData[0][1] = 'e' ;$aData[0][2] = 't'
Attachments (0)
Change History (6)
comment:3 by , on Oct 19, 2013 at 8:14:51 AM
This is the correct format.
#include <Array.au3> Local $aArray[] = [0, 1, 2, 3] _ArrayDisplay($aArray)
comment:4 by , on Oct 21, 2013 at 3:27:17 AM
The requesters first example works as well.
Local $aData = ['p','e','t']
Creates an array with 3 elements containing p, e, and t.
comment:5 by , on Oct 22, 2013 at 11:22:13 AM
But cant like this:
Func test()
Return ['t','e','s','t']
EndFunc
comment:6 by , on Oct 22, 2013 at 5:22:42 PM
What you are asking for are called literal arrays.
The idea has been looked at before. I'm not sure how far it got, or whether it is still on the table.
comment:7 by , on Dec 2, 2013 at 9:24:36 PM
| Resolution: | → Duplicate |
|---|---|
| Status: | new → closed |
Duplicate of #2548. I'm going to bend the rules slightly and close this ticket as a duplicate of the other one (don't shoot me guys) as the other ticket is better.

You can already use the first format to declare an array in the latest beta.