8.8.1.1.2.2.7. Expressions¶
- class Expressions¶
- evaluate(expression) None | int | str | float¶
Evaluates a GEL expression and returns the resulting value, if numerical or a string. All standard rules for GEL expressions apply. If the result of evaluating the expression is an integral value, a BigInt will be returned. If the value is a floating point value, a standard Javascript number will be returned. For any other value, like a reference to a c++ object, we return without a value.
# Adds 8 to the address of the main symbol, returns an int result = session.expressions.evaluate("main + 8") # Returns a floating point number result = session.expressions.evaluate("1.0 / 2") # Call a GEL function (assuming that this function is defined in a loaded GEL script) session.expressions.evaluate('userDefinedGelFunction()')
- Parameters:
expression (str) -- The GEL expression to evaluate.
- Returns:
The value resulting from the evaluation of the expression, if numerical or a string.
- Return type:
None | int | str | float