JavaScript Editor js editor     Web development 



Main Page

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

ALEN(ArrayName [, nArrayAttribute])

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).

Return Value

Numeric

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.

В Copy Code
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



JavaScript Editor js editor     Web development