Stores a specified value into one or more locations in an array, and returns the number of elements stored.

Syntax

<oRef>.fill(<exp> [, <start expN> [, <count expN>]])

<oRef>

A reference to a one- or two-dimensional array you want to fill with the specified value <exp>.

<exp>

An expression you want to store in the specified array.

<start expN>

The element number at which you want to begin storing <exp>. If you do not specify <start expN>, dBASE Plus begins at the first element in the array.

<count expN>

The number of elements in which you want to store <exp>, starting at element <start expN>. If you do not specify <count expN>, dBASE Plus stores <exp> from <start expN> to the last element in the array. If you want to specify a value for <count expN>, you must also specify a value for <start expN>.

If you do not specify <start expN> or <count expN>, dBASE Plus fills all elements in the array with <exp>.

Property of

Array

Description

Use fill( ) to store a value into all or some elements of an array. For example, if you are going to use elements of an array to calculate totals, you can use fill( ) to initialize all values in the array to 0.

fill( ) stores values into the array sequentially. Starting at the first element in the array or at the element specified by <start expN>, fill( ) stores the value in each element in a row, then moves to the first element in the next row, continuing to store values until the array is filled or until it has inserted <count expN> elements. fill( ) overwrites any existing data in the array.

If you know an element’s subscripts, you can use element( ) to determine its element number for use as <start expN>.