Execute: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
<pre> | <pre> | ||
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 | |||
</pre> | </pre> | ||
Line 27: | Line 27: | ||
== Related Items == | == Related Items == | ||
[[eval| | [[eval|Eval]] | ||
[[Category:Language Reference]] | [[Category:Language Reference]] |
Revision as of 00:47, 24 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