ALEN( ) Function

Returns the number of elements, rows, or columns in an array.

ALEN(ArrayName [, nArrayAttribute])

Return Values

Numeric

Parameters

  • ArrayName
    Specifies the name of the array. If you include only the array name, ALEN( ) returns the number of elements in the array.
  • nArrayAttribute
    Determines whether ALEN( ) returns the number of elements, rows or columns in the array according to the following values for nArrayAttribute:
    0 Returns the number of elements in the array. Omitting nArrayAttribute is identical to specifying 0.
    1 Returns the number of rows in the array.
    2 Returns the number of columns in the array. If the array is a one-dimensional array, ALEN( ) returns 0 (no columns).

Example

The following example uses AFONT( ) to create an array containing the names of all available fonts. ALEN( ) is used to determine the number of rows in the array. The name of each font is displayed, along with an example of the font. If more than 10 fonts are installed, only the first 10 are displayed.

CLEAR
=AFONT(gaFontArray)  && Array containing font names
gnNumFonts= ALEN(gaFontArray)  && Number of fonts
IF gnNumFonts > 10
   gnNumFonts = 10  && Display first 10 fonts
ENDIF

FOR nCount = 1 TO gnNumFonts
   ? ALLTRIM(gaFontArray(nCount))  && Display font name
   ?? '  This is an example of ' ;
      + ALLTRIM(gaFontArray(nCount)) FONT gaFontArray(nCount), 8
ENDFOR

See Also

ADEL( ) Function | ADIR( ) Function | AELEMENT( ) Function | AFIELDS( ) Function | AINS( ) Function | ASCAN( ) Function | ASORT( ) Function | ASUBSCRIPT( ) Function | DIMENSION Command | STORE Command | AFONT( ) Function