eval
eval
Function
Compiles and executes a string script, returning the value of the script's explicit return or exit.
Syntax
eval(source)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| source | String | No | '' | BT source code to be executed. |
Return value
| Type | Description |
|---|---|
| Any/Empty | The corresponding value is returned when the script is executed to return or exit; Empty is returned when normal execution ends or the source code is empty. |
Example
result = eval('return 3') // Output: 3 print result
Notes
- eval shares the global environment of the current VM.
- This capability is suitable for REPL, debugging, and scenarios where dynamic scripting is clearly required.