Skip to main content

eval_arithmetic

Function eval_arithmetic 

Source
pub fn eval_arithmetic(expr: &str, scope: &Scope) -> Result<i64>
Expand description

Evaluate an arithmetic expression string.

The expression should be the content between $(( and )).

§Example

let scope = Scope::new();
scope.set("X", Value::Int(5));
let result = eval_arithmetic("X + 3", &scope)?;
assert_eq!(result, 8);