Execute: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "Execute(''string'') '''Description''' EXECUTE executes an expression or file as if it were code substituted in the program. The required parameter, ''string'', can be either...")
 
No edit summary
Line 1: Line 1:
Execute(''string'')
Execute(''string'')


'''Description'''
== Description ==


EXECUTE executes an expression or file as if it were code substituted in the program. The required parameter, ''string'', can be either a string expression or the name of a file containing statements that is executed. If multiple statements are to be executed, separate them with a carriage return (vbCRLF). The code can access and modify all variables in the current running program.
Execute executes an expression or file as if it were code substituted in the program. The required parameter, ''string'', can be either a string expression or the name of a file containing statements that is executed. If multiple statements are to be executed, separate them with a carriage return (vbCRLF). The code can access and modify all variables in the current running program.


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


'''Example'''
== Example ==


<pre>
<pre>
REM EXECUTE execute a string as a SUB
REM Execute execute a string as a SUB
DIM x
Dim x
x = 5
x = 5
EXECUTE("PRINT x * 10")
Execute("PRINT x * 10")
EXECUTE("x = x * 10")
Execute("x = x * 10")
PRINT x
PRINT x
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 25: Line 25:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[eval|EVAL]]
[[eval|EVAL]]
[[Category:Language Reference]]

Revision as of 21:13, 8 August 2012

Execute(string)

Description

Execute executes an expression or file as if it were code substituted in the program. The required parameter, string, can be either a string expression or the name of a file containing statements that is executed. If multiple statements are to be executed, separate them with a carriage return (vbCRLF). The code can access and modify all variables in the current running program.

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

Example

REM Execute execute a string as a SUB
Dim x
x = 5
Execute("PRINT x * 10")
Execute("x = x * 10")
PRINT x

Output

50
50

Related Items

EVAL