Removing Items From an Array

You can remove elements from either the start or the end of the array:

  • Use the POP method to select and remove an element from the end of an array

    Local Array of Number &MYARRAY;
    
    &MYARRAY = CreateArray();
    &MYARRAY[1] = 100;
    &MYARRAY[2] = 200;
    &MYARRAY[3] = 300;
    
    &ANSWER = &MYARRAY.Pop();

    &ANSWER will equal 300.

  • Use the SHIFT method to select and remove an element from the beginning of an array

    Local Array of Number &MYARRAY;
    
    &MYARRAY = CreateArray();
    &MYARRAY[1] = 100;
    &MYARRAY[2] = 200;
    &MYARRAY[3] = 300;
    
    &ANSWER = &MYARRAY.Shift();

    &ANSWER equals 100.