Search code examples
ternary-operatorrpgle

Does RPGLE has a ternary operator?


I did find old posts on forums about this question. But as they were old, I was wondering if it changed.

I know that, back maybe in 2004, RPG did not have ternary operator. Having work a bit in C# and Java, I did use them and I like them. I was wondering if RPGLE eventually included them, somehow.

In C#, a ternary operation looks like this :

myvar = var1 > var2 ? var1 : var2;

So if var1 is greater than var2, myvar will get var1. This was a basic example.

So... do you guys know if there's a ternary operator in RPGLE and if there is, what's its syntax?


Solution

  • No, RPGLE does not have ternary-operators.

    http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasd/expropt.htm