Runtime evaluation: Difference between revisions
Content added Content deleted
(Added JavaScript example) |
(eliminate unneeded parenthesis from J "evaluate with argument" example, clean up description) |
||
Line 228:
<lang j>". 'a =: +/ 1 2 3' NB. execute a string to sum 1, 2 and 3 and assign to noun a</lang>
Only J expressions are allowed in strings used as as arguments for <code>".</code> (control words and blocks of expressions are not allowed).
<lang j>
Rules of scope for such functions match those described on the [[Scope modifiers]] page.
▲Rules of scope for such functions match those described on the [[Scope modifiers]] page. These words behave like any other words in the language and may be used in forming expressions. Expressions and statements, including control words, are allowed in these explicit definitions.
=={{header|Lua}}==
<lang lua>f = loadstring(s) -- load a string as a function. Returns a function.
|