Announcement

Collapse
No announcement yet.

Question about; return new Array()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about; return new Array()

    If I would like to change the number of data points in the "return new Array()" function how would it be done.

    Here is an example of what I am talking about;


    vLen = 2
    for(i = 0; i < vLen; i++)
    Stop[i] = vValue4 + SATR[i];
    }
    return new Array (Stop[0],Stop[1]);

    This returns 2 values to be drawn. What if I want to change the variable vLen from 2 to 3.

    vLen = 3
    for(i = 0; i < vLen; i++)
    Stop[i] = vValue4 + SATR[i];
    }
    return new Array (Stop[0],Stop[1],Stop[2]);

    3 values returned. The problem is I have to go back into the code and add "Stop[2]" to the "return new Array ()" function.

    Is there a way to this with out having to go back into the code. Is there a way to program it?

  • #2
    Hi Whatever:

    Yes. Simply use:

    return( Stop );

    "Stop" is already an array so the total number of elements in your array Stop will be returned (e.g., if you only set 2 elements then 2 values will be returned.... if you set values in 5 of the elements then 5 values would be returned).

    Chris

    Comment


    • #3
      Thanks very helpful

      Comment

      Working...
      X