JoeCool Posted March 19, 2010 Posted March 19, 2010 It could be really handy to be able to reinitialize array in the code like this ... standard declaration dim $xy[2] = [0,0] somewhere in the code $xy = [10,4] instead of $xy[0] = 10 $xy[1] = 4 It could also be handy to be able to reintialize in a standard declaration way after a Redim, ofcourse in that case we will lose previous values... dim $a[2] = [0,1] ... redim $a[3] = [3,2,1] what do u thing ? of course it is a little bit more job for the interpreter, but less prone to error maybe
doudou Posted March 19, 2010 Posted March 19, 2010 Ok, I would vote for empty arrays but this... sorry, what sense would it make? Only to spare a Dim? UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE
Mat Posted March 19, 2010 Posted March 19, 2010 dim $a[2] = [0,1] ... redim $a[3] = [3,2,1] have you tried this? #include <Array.au3> Dim $a[2] = [0, 1] _ArrayDisplay($a, "First") Dim $a[3] = [5, 4, 3] _ArrayDisplay($a, "Second") Simple Eh?? AutoIt Project Listing
JoeCool Posted March 20, 2010 Author Posted March 20, 2010 (edited) Simple Eh?? AutoItSetOption("MustDeclareVars", 1) foo() exit func foo( ) local $i, $j local $xy[2] = [1,2] local $xy[4] local $xy[3] = [1,2,3] local $xy[2] = [0,0] for $i = 1 to 2 local $xy[3] = [$i,$i,$i] $j = $i next $xy[2] = 9 endfunc OMG !, I'm so old school, I never thought to redefine variables like that ! But you're right who need reinitialization when when you can redeclare all you want ! in my head it's not the same but here it seems to be the same. Edited March 20, 2010 by JoeCool
JoeCool Posted March 20, 2010 Author Posted March 20, 2010 (edited) Ok, I would vote for empty arrays but this... sorry, what sense would it make? Only to spare a Dim?yes i just read that nice thread :) im not sure multiple redefinitions in the same namespace is a nice way to reinitilization .... but im old school... Edited March 20, 2010 by JoeCool
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