Product SiteDocumentation Site

5.3.6.11. delete


           +-,-----+
           V       |
>>-delete(---index-+-)-----------------------------------------><

Returns and deletes the member item with the specified index from the array. If there is no item with the specified index, the Nil object is returned and no item is deleted. All elements following the deleted item will be moved up in the array ordering and the item indexes will adjusted for the deletion. The size of the collection will be reduced by 1 element.
The delete method is only valid with single-dimension arrays. The index argument may also be specified as an array of indexes.

Example 5.136. Array class - delete method

   a = .array~of("Fred", "Mike", "Rick", "David")
   a~delete(2)  -- removes "Mike", resulting in the array
                -- ("Fred", "Rick", "David")