The EXTEND method increases the size of a collection. The EXTEND method has three variations. The first variation appends a single NULL element to a collection. The syntax for this variation is:
Where collection is the name of a collection.
This example uses the EXTEND method to append a single, null element to a collection:
COUNT indicates that before the EXTEND method, there were five elements in the collection. After the EXTEND method is invoked, the collection contains six elements.
This variation of the EXTEND method appends a specified number of elements to the end of a collection:
Where:
collection is the name of a collection.
count is the number of null elements added to the end of the collection.
This example uses the EXTEND method to append multiple null elements to a collection:
COUNT indicates that before the EXTEND method, there were five elements in the collection. After the EXTEND method is invoked, the collection contains eight elements.
This variation of the EXTEND method appends a specified number of copies of a particular element to the end of a collection:
Where:
collection is the name of a collection.
count is the number of elements added to the end of the collection.
index_number is the subscript of the element that's being copied to the collection.
This example uses the EXTEND method to append multiple copies of the second element to the collection:
COUNT indicates that before the EXTEND method, there were five elements in the collection. After the EXTEND method is invoked, the collection contains eight elements.
Note
You can't use the EXTEND method on a null or empty collection.