Ternary Operator

Jan 5, 2012 at 6:53 PM

Hello Everyone,

Has anyone been successful in making a ternary operator? Basically I just want to have a simple expression like this:

x = (true) ? 1 : 0

If I could get some pointers on how to do this I would really appreciate it.

Jan 5, 2012 at 7:31 PM

It works already in expression evaluator; start grammar explorer, load SampleExpressionEvaluator grammar, then enter this script:

x = 1>0 ? 1 : 0

Run it, the result is 1, as expected. The only difference is "true" constant, expr evaluator does not know about this, it is not defined there as a constant. Should be, probably.


Jan 5, 2012 at 9:19 PM

Thanks for the help Roman. I downloaded the newest version of Irony and it had what I was looking for.