Adds an element, row, or column to an array and returns the number of added elements.

Syntax

<oRef>.grow(<expN>)

<oRef>

A reference to a one- or two-dimensional array you want to add elements to.

<expN>

Either 1 or 2. When you specify 1, grow( ) adds a single element to a one-dimensional array or a row to a two-dimensional array. When you specify 2, grow( ) adds a column to the array.

Property of

Array

Description

Use grow( ) to insert an element, row, or column into an array and change the size of the array to reflect the added elements. grow( ) can make a one-dimensional array two-dimensional. All added elements are initialized to false values.

One-dimensional arrays

When you specify 1 for <expN>, grow( ) adds a single element to the array. When you specify 2, grow( ) makes the array two-dimensional, and existing elements are moved into the first column. This is shown in the following figure:

image\AGROW1_shg.gif

Use add( ) to add a new element to a one-dimensional array and assign its value in one step.

Note

You may also assign a new value to the array’s size property to make a one-dimensional array any arbitrary size.

Two-dimensional arrays

When you specify 1 for <expN>, grow( ) adds a row to the array at the end of the array. This is shown in the following figure:

image\AGROW2_shg.gif

When you specify 2 for <expN>, grow( ) adds a column to the array and places false into each element in the column.