eval

eval

eval

Function

Compiles and executes a string script, returning the value of the script's explicit return or exit.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
sourceStringNo''BT source code to be executed.

Return value

TypeDescription
Any/EmptyThe 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

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.