-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another Bug with nested ternaries #158
Comments
Addendum: |
Solution and apology: A workaround is to put nested ternary expression in parentheses, which then works: Comment on the implementation of ternary expressions in govaluate The question is: |
The following nested ternary expression fails to evaluate:
(44 != 0 ? 44 : 22 != 0 ? 22 : 11) != 0
the reported error was: eval error in boolean expression
A very similar ternary expression evaluates OK:
(44 < 33 ? 44 : 22 < 11 ? 22 : 11) != 0
I presume the difference is in the use of reflect.DeepEqual for the != operator and not for the < operator.
Another similar nested ternary expression to case 1. is also OK, despite the fact that it uses the != operator:
(44 != 0 ? 33 != 0 ? 33 : 22 : 11) != 0
These expressions are generated by users of the language translator I am developing. Expression 1. works Ok in C.
I am very happy I found the govaluate library - it does a great job for the language translator - Thank you.
The text was updated successfully, but these errors were encountered: