Jump to content

Array reintialization


JoeCool
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

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 + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Link to comment
Share on other sites

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 by JoeCool
Link to comment
Share on other sites

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 by JoeCool
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...