| |
|
| Format |
1. Evaluate
string expression: EVS(var$ [ ,val$
] [,ERR=stmtref])
2. Evaluate expression: EVN(
=strexpr [ , val$ ] [,ERR=stmtref])Where:
| 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; For example:
A=9999; PRINT
EVS("str(a:""##0"")","<OverFlow>")
This will display
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. |
| strexpr |
String expression
to be processed and whose value will be returned
by the EVS function. |
| stmtref |
Program
line number or statement label to which to
transfer control. |
|
| |
|
| Returns |
Evaluated
contents of string variable. |
| |
|
| Format
1 |
The EVS(
) function evaluates and returns the value
(evaluated contents) of a string variable. |
| |
|
| Format
2 |
This format
of the EVS( ) function simply returns
the value of the expression supplied in strexpr.
This format is used when you have a constant expression
but want to place an error trap around the expression. If the default value (val)
is supplied, it will be returned if the expression
results in an error. If no default value is supplied and
an error occurs, the ERR= trap will be taken.
This
format of EVS function is +PxPlus
Exclusive (build 9200)
|
| |
|
| See
Also |
EVN( ) Evaluate Numeric
Expression
VIN(
) and VIS( ) Obtain Value of Variable. |
| |
|
| 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.
0010
CST_NAME$=who,CST_ADDR$="8920 Woodbine Ave"
0020
CST_CITY$="Markham",CST_CONTACT$="Support"
0030 input
"Which field (NAME,ADDR,CITY,CONTACT):",X$
0040 print
evs("CST_"+X$+"$")
0050 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.
|