Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[epsilon-dev] Ternary operator now available

Hi everyone,

 

Just to let you know that I have added a ternary operator to EOL (as requested in [1]), which should make programs more concise (especially EGL templates). This is a more advanced ternary operator than is available in Java: you do not have to assign the result to a variable or return it, but can use it anywhere you would any other _expression_. You can also use the “else” keyword in place of the colon to separate the true and false expressions, which is perhaps more readable for those less familiar with ternary syntax.

I also considered the Python-style ternary (which is of the form <exprIfTrue> if <exprCondition> else <exprIfFalse>) but given that EOL is heavily Java-inspired I didn’t implement this for consistency (also a matter of taste, but the Python style ternary is less intuitive to a lot of programmers, though perhaps it’s more readable for non-programmers).

 

Thanks,

Sina

 

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=514986


Back to the top