Modify

Opened 12 years ago

Closed 12 years ago

#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, 12 years ago

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

comment:3 by guinness, 12 years ago

This is the correct format.

#include <Array.au3>

Local $aArray[] = [0, 1, 2, 3]
_ArrayDisplay($aArray)

comment:4 by BrewManNH, 12 years ago

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, 12 years ago

But cant like this:
Func test()

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

EndFunc

comment:6 by Matt Diesel, 12 years ago

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, 12 years ago

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.