Eval

From NSB App Studio
Revision as of 03:47, 4 July 2012 by Brendon (talk | contribs) (Created page with "EVAL(''string'') '''Description''' EVAL returns a value created by executing an expression as if it were a FUNCTION procedure. The required parameter, ''string'', is a strin...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

EVAL(string)

Description

EVAL returns a value created by executing an expression as if it were a FUNCTION procedure. The required parameter, string, is a string expression that is executed. If multiple statements are to be executed, separate them with a carriage return (vbCRLF). The temporary, virtual procedure that gets created has all program variables passed in by value, so the variables are unmodifiable by the EVAL function.

The code in the string is evaluated as JavaScript code. See the TechNote “Using JavaScript with NS Basic/X Programs”.

Example

REM EVAL Example
'EVAL execute a string as a FUNCTION
DIM x
x = 5
PRINT EVAL("x")
EVAL("x = x * 10")
PRINT x

Output

5
5

Related Items

EXECUTE