Ternary Operators

Caché

Hello community, simple question. I've been able to use a ternary operator equivalent by using $select for inline if statements using this pattern:

set x = 1

set result = $select(x = 1: "true", x = 0: "false")

These can be nested and can have a lot of options. But I'm curious if there is a native way of using ternary operators in ObjectScript?

Thank you

  • 0
  • 0
  • 324
  • 0
  • 1

Answers

There is no direct equivalent in ObjectScript to the ternary operator. You can use $SELECT or $CASE