1. #1
    Senior Member Follow User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    484

    Default Set all variables in a list at once?

    Is there any way to set all the variables in a variable list with one command?

    I have a fairly large list and right now I am just looping varset with the loop number as the index. I was just curious if there was a better/easier way.

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    No, not for a global variable. A local variable would be automatically reset. For example, at the start of the routine you would declare the variable like this:

    [VarDef,myVar(10),5]

    This would ensure that every time the routine was called each variable in the list myVar was set to 5. But of course the list variable would only be available within the routine.

    I should think that in terms of processing time there's really no difference though. Each variable in the list has a separate memory address and the processor has to set each one, whatever code you use.

  3. #3
    Senior Member Follow User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    484

    Default

    Ah ok. I assumed that was the case.

    I just didn't know if there was any secret hidden in there

    Thanks for the info again Marcus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •