ARRAY DELETE ELEMENT This command will delete the specified item from the array.
Syntax
    ARRAY DELETE ELEMENT Array Name(0)
    ARRAY DELETE ELEMENT Array Name(0), Index
Parameters
    Array Name(0
Integer The name of the array followed by a pair of brackets ( ). You can also insert a value of zero, i.e. arrayname(0)
    Index
Integer This value is an integer number such as 1.
Returns
This command does not return a value.
Description
You specify the item using the array index. When the item is deleted, all elements thereafter are shuffled back one space and the size of the array is reduced accordingly.
Example Code
    dim a() as integer

    empty array a()

    print "Add 5 items to the list"

    for i=1 to 5

       n = rnd(1000)

       print "  Adding "; n; " to the list"

       array insert at bottom a()

       a() = n

    next i

    print

    PrintList()

    print

    print "Run through the list forwards"

    array index to top a()

    while array index valid( a() )

       print a()

       next array index a()

    endwhile

    print

    print "Run through the list backwards"

    array index to bottom a()

    while array index valid( a() )

       print a()

       previous array index a()

    endwhile

    print

    print "Step forward to the third item and delete it"

    array index to top a()

    next array index a()

    next array index a()

    array delete element a()

    PrintList()

    print

    print "Now insert 3 new random numbers at the top of the list"

    for i=1 to 3

       n = rnd(1000)

       print "  Adding "; n; " to the list"

       array insert at top a()

       a() = n

    next i

    print

    PrintList()

    print

    print "Deleting every item under 500"

    array index to top a()

    while array index valid( a() )

       if a() < 500

          array delete element a()

       else

          next array index a()

       endif

    endwhile

    PrintList()

    wait key

    end

    function PrintList()

       if array count( a() ) >= 0

          print "The list has "; array count( a() )+1; " items"

          for i=0 to array count( a() )

             print "  Item "; i; " = "; a(i)

          next i

       else

          print "The list is empty"

       endif

    endfunction
See also
CORE Commands Menu Index