Evaluation
In this section you will find recipes of how you can use Just Functional for the most common scenarios.
Constant Expressions
string fx = "(3+2)^2";
Function f = new Function(fx);
decimal result = f.Evaluate(new EvaluationContext());
//result = 25
Function with single variable
string fx = "(X+2)^2";
Function f = new Function(fx);
decimal result = f.Evaluate(new EvaluationContext(new Dictionary<string, decimal>(){["X"]=3}));
//result = 25
Function with multiple variables
string fx = "(X+Y)^2";
Function f = new Function(fx);
decimal result = f.Evaluate(new EvaluationContext(new Dictionary<string, decimal>(){["X"]=3,["Y"]=2}));
//result = 25
What’s next
You can learn the more about the Syntax Validation or go to the docs.