Name
RemoveItem -- remove item from a list (V2.0)
Synopsis
e = RemoveItem(array[, pos])
Function
This function removes an item from a list and returns it. If you omit the optional argument pos, the last item of the list will be removed. Otherwise the specified item is removed. Position 0 specifies the first item of the list. After removing the item, the array is reorganized to close the gap.

Inputs
array
table from where to remove the element
pos
optional: item that is to be removed (defaults to -1 which means that the last element should be removed)
Results
e
the item that was just removed
Example
a = {1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10}
e = RemoveItem(a, 7)
For k = 1 To ListItems(a) Do Print(a[k - 1] .. " ")
Removes the number 8 because it is twice in the list. The variable e will receive the value 8. After removing the item, the correct row will be printed: "1 2 3 4 5 6 7 8 9 10".

Show TOC