DYNAMIC ARRAY.insertElement

Inserts a new element at the given index.

Syntax

insertElement( index INTEGER )
  1. index is the position where a new element must be inserted.

Usage

This method inserts a new element in the array, before the specified index.

Note: No error is raised if the index is out of bounds.

Example

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