Runtime evaluation: Difference between revisions

Content added Content deleted
imported>Arakov
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
Line 2,053: Line 2,053:
$ wren-cli
$ wren-cli
\\/"-
\\/"-
\_/ wren v0.3.0
\_/ wren v0.4.0
> 20 + 22
> 20 + 22
42
42
Line 2,065: Line 2,065:


Secondly, Wren has the ''Meta.eval'' method which can be used from within a script to execute any valid Wren code (presented to it in string form) at runtime. The string could be constructed within the script, obtained from a file or input by the user. Here's a very simple example:
Secondly, Wren has the ''Meta.eval'' method which can be used from within a script to execute any valid Wren code (presented to it in string form) at runtime. The string could be constructed within the script, obtained from a file or input by the user. Here's a very simple example:
<syntaxhighlight lang="ecmascript">import "meta" for Meta
<syntaxhighlight lang="wren">import "meta" for Meta


var s = "for (i in 0..4) System.print(i)"
var s = "for (i in 0..4) System.print(i)"