mercredi 22 avril 2020

Dynamic if statement condition generation and evaluation

I want to evaluate dynamic if statement like the e.g below

int a=2; String condition="a==2";

if(condition) execute something else execute something

I mean that the condition is changeable. For example:

String condition=""; int a, b, c, d;

.... The condition could be:

condition = "a == 2";

or could be:

condition = "a >= b && c == a && ((d - 4) == a ) ";

or

condition = ".....something else......";

The condition is not constant. That's my problem. And this is the requirement.

How i can do this... Please let me know.. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire