Eval
The Eval function evaluates an expression by using the specified context.
Syntax
The Eval function
has the following syntax:
Integer | Float | String | Boolean = Eval(Expression, Context)Note: In JavaScript, the
Float variable
returns extra precision, for example, 10.695671999999998 instead
of 10.695672. In IPL, integer division of 10/5 is 2.0.
In JavaScript, integer division of 10/5 is 2.Parameters
The Eval function
has the following parameters.
Parameter |
Format |
Description |
|---|---|---|
|
String |
Expression to evaluate. |
|
Context |
Context to use in evaluating the expression. |
Return value
Result of the evaluated expression.
Example
The following example shows how to evaluate an expression using the given context.
MyContext = NewObject();
MyContext.a = 5;
MyContext.b = 10;
MyResult = Eval("a + b", MyContext);
Log(MyResult);This example prints the following message to the policy log:
Parser Log: 15