Function ADel() Foundation

Delete an element from an array.

Syntax
ADel( <aArray>, <nElement> ) --> aSource
Parameters
<aArray>
<aArray> is the array from which an element is deleted.
<nElement>
<nElement> is a numeric value specifying the position of the element to delete.
Return

ADel() returns the reference to <aArray>.

Description

The array function ADel() deletes the contents of an element from an array. The content (or value) of the element is lost and all subsequent elements shift up one position. The value of the last element becomes NIL. The number of array elements Len(<aArray>) remains unchanged by ADel(). To remove the last element after ADel(), the function ASize() must be used.

Examples
ADel()
// In the example, the content of an array element is deleted 
// and then the last element of the array is removed. 

PROCEDURE Main 
   LOCAL aArray 

   aArray := {"A","B","C","D","E"} 

   ADel( aArray, 3 )        // aArray is: {"A","B","D","E", NIL } 

   ASize( aArray, Len(aArray)-1 ) 
                            // aArray is: {"A","B","D","E"} 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.