Modify

#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:2 by BrewManNH, on Oct 18, 2013 at 2:31:18 AM

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

comment:3 by guinness, 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 BrewManNH, 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 anonymous, on Oct 22, 2013 at 11:22:13 AM

But cant like this:
Func test()

Return ['t','e','s','t']

EndFunc

comment:6 by Matt Diesel, 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 Matt Diesel, on Dec 2, 2013 at 9:24:36 PM

Resolution: Duplicate
Status: newclosed

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.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.