Runtime evaluation: Difference between revisions

Content added Content deleted
(Added Oz.)
Line 235: Line 235:


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.
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.

one = loadstring"return 1" -- one() returns 1

two = loadstring"return ..." -- two() returns the arguments passed to it</lang>


=={{header|Oz}}==
=={{header|Oz}}==