428
EVS( ) Function
Evaluate String Expression
Format
EVS(var$[,val$][,ERR=stmtref])
Where:
stmtref Program line number or label to transfer control to.
val$
Value to be returned if the evaluation fails at run-time (with any error
except a syntactical error). Optional. If you include a value, the error will
be ignored and the value will be returned instead; e.g.,
A=9999; PRINT EVS("str(a:""##0"")","<OverFlow>")
returns the value <Overflow> rather than generate
Error #43: Format mask invalid.
var$
String variable name. Receives the returned evaluated contents of the
variable. You can build the variable name using string expressions, as in
the example below.
Returns
Evaluated contents of string variable.
Description
The EVS( ) function evaluates and returns the value (evaluated contents) of a string
variable.
See Also
Examples
In this example, EVS( ) builds the string variable's field name ("CST_"+X$+"$")
based on the user's input and returns the value stored in it.
00010
CST_NAME$=who,CST_ADDR$="8920 Woodbine Ave"
00020
CST_CITY$="Markham",CST_CONTACT$="Support"
00030
input "Which field (NAME,ADDR,CITY,CONTACT):",X$
00040
print evs("CST_"+X$+"$")
00050
stop
For instance, if the user's input for X$ in the example above is NAME, the variable
name will be CST_ADDR$. The value in EVS(CST_ADDR$) for the current record
could be 8920 Woodbine Ave, which is what ProvideX would return and then print.