Runtime evaluation: Difference between revisions

Add lang example
m (→‎{{header|Slope}}: fix broken markup)
(Add lang example)
Line 858:
48
>>> :quit
</pre>
 
=={{header|Lang}}==
<syntaxhighlight lang="lang">
# Simple assignements are used so that rvalues are parsed as TEXT values
$code=fn.println(Hello World!)
# Returns VOID unless return or throw is explicitly used
fn.exec($code)
 
$code=return Hello World!
fn.println(fn.exec($code))
 
$code=throw $LANG_ERROR_DIV_BY_ZERO
# Will print "Dividing by 0" in the Standard Lang implementation (Error texts are not standardized)
fn.println(fn.errorText(fn.exec($code)))
 
$code=parser.op(20//0)
# Will return VOID because no error was thrown explicitly
fn.println(fn.exec($code))
</syntaxhighlight>
This is the output for the Standard Lang implementation.
{{out}}
<pre>
Hello World!
Hello World!
An error occured [error output: redacted]
Dividing by 0
An error occured [error output: redacted]
</pre>
 
168

edits