1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Way to [re]initialize an array

Discussion in 'Suggestions' started by vefatica, Aug 30, 2017.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    ... regardless of dimensions ...

    maybe "FILLARRAY <array_name> <string>

    Also, "SETARRAY /0 ..." might initialize all entries to "0" when it's created.
     
  2. AnrDaemon

    Joined:
    Aug 23, 2010
    Messages:
    51
    Likes Received:
    1
    What's wrong with unsetting and redefining it?
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    I don't just want to [re]define it. I want to [re]initialize it with data.

    Code:
    setarray [/f] /0 a[%len,2]
    would be a lot easier than
    Code:
    setarray [/f] a[%len,2]
    do i=0 to %@dec[%len] ( do j=0 to 1 ( set a[%i,%j]=0 ) )
     
    rps likes this.
  4. rps

    rps

    Joined:
    Jul 6, 2008
    Messages:
    232
    Likes Received:
    3
    I don't use arrays that often, but when I do your suggestions would be helpful.

    IMHO, this addition would also make the code easier to understood.
     

Share This Page