NEA
String/Numeric Array Data
This numeric function returns information about a numeric or string array based on its latest DIM directive.
Syntax
Section titled “Syntax”NEA ( array-name, numeric-code [,ERR=line-ref|,ERC=error-code])array-name- is any string, which represents the name of a numeric or string array.
numeric-code- is any integer from -3 to 3 which determines the value returned by this function:
-3 Returns the lower bound of the third dimension.
-2 Returns the lower bound of the second dimension.
-1 Returns the lower bound of the first dimension.
0 Returns the number of dimensions in the array (1, 2, or 3).
1 Returns the difference between the high and low bound of the first dimension.
2 Returns the difference between the high and low bound of the second dimension.
3 Returns the difference between the high and low bound of the third dimension.
line-ref- is the program line number or label to branch to if an error is produced by this function.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Remarks
Section titled “Remarks”This function is generally available starting with release level 8.1.
The numeric-code values 1, 2, and 3 return the difference between the high and low bound for that dimension. This returned value is not the number of elements in the dimension. For example, if a numeric array is dimensioned to 10, the low bound is 0 by default; this array has 11 elements though the NEA of its dimension is 10.
This function returns a 0 (zero) if array-name is not an array, array-name has not been defined or dimensioned, or array-name is not a valid variable name (e.g., more than 33 characters).
If a numeric-code other than the positive integers 0 through 3 is used, an ERR=41 results.
Examples
Section titled “Examples”PRINT NEA ( "5" , 0 )prints 0 (zero) since “5” is not a valid variable name and, therefore, cannot be a valid array name.
Assuming the following:
DIM NUMERIC_ARRAY ( 5, 10 )DIM STRING_ARRAY$ [ 10, 15, 20 ]the results are:
NEA ( “NUMERIC_ARRAY” , 0 ) returns 2
NEA ( “NUMERIC_ARRAY” , 1 ) returns 5 (low bound = 0, high bound = 5)
NEA ( “NUMERIC_ARRAY” , 2 ) returns 10 (low bound = 0, high bound = 10)
NEA ( “NUMERIC_ARRAY” , 3 ) returns 0 (dimension not defined)
NEA ( “STRING_ARRAY$” , 0 ) returns 3
NEA ( “STRING_ARRAY$” , 1 ) returns 10 (low bound = 0, high bound = 10)
NEA ( “STRING_ARRAY$” , 2 ) returns 15 (low bound = 0, high bound = 15)
NEA ( “STRING_ARRAY$” , 3 ) returns 20 (low bound = 0, high bound = 20)
00100 DIM STR_ARRAY$[-10:10,-5:5,-20:20]; FOR OPT=-3 TO 3; PRINT "OPTION", OPT, " --> ", NEA("STR_ARRAY$", OPT); NEXT OPTproduces the following output:
OPTION -3 --> -20OPTION -2 --> -5OPTION -1 --> -10OPTION 0 --> 3OPTION 1 --> 20OPTION 2 --> 10OPTION 3 --> 40See also
Section titled “See also”DIM numeric array, DIM string array, and DUMP (with ARRAYS option) directives
From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF