GLBasic User Manual

Main sections

DELETE

DELETE item



This command removes the entry within a FOREACH/NEXT block that "item" currently points to.
Directly after this, the loop continues from the top pointing at the element after the removed one.
Thus, it's equivalent to:
DIMDEL array[], index
CONTINUE


Sample:
// Make an array of numbers
DIMDATA a[], 3,4,5, 12,13, 6

// Enumerate the numbers
FOREACH num IN a[]
    // throw out numbers bigger than 10, and continue
    IF num>10 THEN DELETE num
    a$=a$ + num + ", "
NEXT
PRINT a$, 0,0

SHOWSCREEN
MOUSEWAIT


Output:
18

See also...