.. highlightlang:: us .. index:: eval .. _eval: eval ==== .. us.tag eval NOTREADYENGLISH New400 Programming.Symboltable :ref:`eval` evaluates the string given as UniScript code. .. function:: ret = eval(ssString) .. us.return **Return Value** The function does not have a return value. Instead it will create an exception, if an error occurs. The exception can be caught with a try/except statement. See also :ref:`evalp`. .. us.params **Parameters** .. uparam:: ssString *ssString* is a string with UniScript code (Statements and or functions). .. us.example **Example** :: eval("a = 1+1"); print a; If :ref:`eval` is used inside a function, all variables used in the eval function are local variables. If eval needs to access variables from the calling function they mus be declared as global. :: def test(rvData, ssOperator, ssLimit) { global data, i; data = rvData; ssString = sprintf("i = find(data %s %s)", ssOperator, ssLimit); eval(ssString); return i; } idx = test([1,2,3,4,5,6,7], "<=", "4.5") if (idx[1] == 0) { MessageBoxError("No data found"); } print idx // prints 1,2,3,4 .. seealso:: :ref:`overview-programming`, :ref:`evalp`, :ref:`eval_file`, :ref:`evalp_file`, :ref:`load` :sub:`id-944627`