delete() / deleteElement()

delete() removes all the specified array elements within the given range or at the given position. This method requires two arguments.

deleteElement() removes only one array element and requires a single argument.

When elements are deleted from a dynamic array, the array size is reduced by the number of the deleted elements.

Syntax:

array_variable.delete(first [,last])

array_variable.deleteElement(element_index)

Usage example:

DEFINE ar DYNAMIC ARRAY OF CHAR(15)
...
  FOR i = 1 TO 100             #the array has 100 elements
    LET ar[i]="element "||i
  END FOR
CALL ar.delete(50)             #the 50th element is deleted and the array size is 99
CALL ar.delete(10,30)          #20 elements are deleted and the array size is 79

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.