expression-evaluator-c-sharp
expression-evaluator-c-sharp copied to clipboard
OR operator return always true
Hi @matheval
really thanks for you library works very well.
I'm facing an issue with "OR" operator that returns always "true".
please find below an online example
https://dotnetfiddle.net/P9zFsG
can you help me ? Thanks in advance Davide
Hi @drimondi1 and @matheval
Until it is fixed you can also generate OR with NOT and AND. This workaround works.
// according to De Morgan's Law
A OR B = NOT ( NOT A AND NOT B )
@drimondi1 @nielll I may have free time on June or July and i will fix it. thank for using this.
Just change the following line "if ((item is Boolean) || (Boolean)item)" to "if ((item is Boolean) && (Boolean)item)" in the following block:
private Boolean LogicalOr(Dictionary<string, Object> args)
{
foreach (Object item in args.Values)
{
if ((item is Boolean) && (Boolean)item)
{
return true;
}
}
return false;
}