-
Notifications
You must be signed in to change notification settings - Fork 0
Conditional Statements
pranithcodes edited this page Apr 6, 2018
·
1 revision
If .. else :
public static void main(String[] args) throws ScriptException {
String script = "if ((X * 2) > 5) { Y = 1; } else { Y = 2; }";
JexlScriptEngine jexlScriptEngine = new JexlScriptEngine();
Bindings bindings = new SimpleBindings();
bindings.put("X", 2);
jexlScriptEngine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
jexlScriptEngine.eval(script);
System.out.println("The value of Y ::" + jexlScriptEngine.get("Y"));
}