DYNAMIC ARRAY as class / DYNAMIC ARRAY methods |
Inserts a new element at the given index.
insertElement( index INTEGER )
This method inserts a new element in the array, before the specified index.
No error is raised if the index is out of bounds.
MAIN DEFINE a DYNAMIC ARRAY OF INTEGER LET a[10] = 11 CALL a.insertElement(10) LET a[10] = 10 DISPLAY a.getLength() -- shows 11 DISPLAY a[10] -- shows 10 DISPLAY a[11] -- shows 11 END MAIN