427
EVN( ) Function
Evaluate Numeric Expression
Format
EVN(var$[,val][,ERR=stmtref])
Where:
stmtref Program line number or label to transfer control to.
val
Default value to be returned if the evaluation fails at run-time (with any
error except a syntactical error). If supplied, the error will be ignored and
the value will be returned instead. For instance, PRINT EVN("40/0",0)
would return val=0 rather than generating Error #40: Divide
check or numeric overflow.
var$
String expression containing numeric variable name. Maximum string
size 8kb. Receives the returned evaluated contents of the variable. You can
build the variable name using string expressions, as in the example below.
Returns
Processed numeric value.
Description
The EVN( ) function evaluates and returns the numeric value of a numeric variable
or computed expression. Use this function to process a stored or computed
expression and obtain its value.
See Also
Examples
In this example, EVN("GL_"+X$) builds the variable name based on user input and
returns the value stored in the variable.
00010
GL_YTD=10000,GL_MTD=3000,GL_CUR=10
00020
input "Which field (YTD,MTD,CUR):",X$
00030
print evn("GL_"+X$):"$###,##0.00-"
00040
stop
For the example above, if the user's input is CUR for X$, the variable name will be
GL_CUR. If the value stored in GL_CUR in the current record is, for example,
9999.63, ProvideX prints that value (using the format mask) as $9,999.63.
In this example, EVN(V$) will print the numeric value stored in V$ for the current
record of logical file number RPT_FN.
0090
K$=KEY(RPT_FN); IF K$(1,12)<>RPT_ID RETURN
0100
READ (RPT_FN)L,C,V$
0110
PRINT (RPT_FN) @(C,L),EVN(V$)
0120
GOTO 0090