Runtime evaluation/In an environment: Difference between revisions

apply nimpretty to codes
(implement in nim-lang)
(apply nimpretty to codes)
Line 717:
 
=={{header|Nim}}==
<lang nim>import macros, strformat
 
macro eval(s, x: static[string]): untyped =
parseStmt(&"let x={x}\n{s}")
 
echo(eval("x+1", "3.1"))</lang>
Output:
<pre>