Function Eval() Foundation
Executes the program code contained in a code block.
Eval( <bBlock>, [<ExpressionList,...>]) --> xLastValue
The return value of Eval() is the value of the last expression in the program code of <bBlock>. Eval() can thus return a value with any data type.
The code block function Eval() executes the program code within a code block. A code block is a value which references a piece of compiled program code and can be assigned to a variable. The code block is generated at a separate time from when the code it referecens it is executed. Code blocks represent a powerful programming tool and Eval() is one of the most powerful functions in Xbase++.
A code block references a piece of program code. This program code is executed when the code block is passed to the function Eval(). When more than one argument is included (<ExpressionList,...>), Eval() passes all subsequent arguments on to the code block. The program code in a code block can consist of a list of expressions separated by commas. The value of the last expression in the list is the return value of the code block and is also returned by the function Eval().
Generally, the program code within a code block is generated at compile time. However, code blocks can be generated at runtime by executing the macro operator (&) to compile a character string having the correct code block syntax.
Using Xbase++, the contents of code blocks can be stored (code blocks can be persistent). In this way generic data driven applications can be written whose program code is partly stored in files and then read and compiled during runtime of a program.
The iteration functions AScan(), AEval(), ASort() and DbEval() each process a code block which is evaluated for each element of an array or database.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.