Ternary Operation

An expression in HCL Detect Expression Language can make use of the the ternary operation: condition? choice1:choice2. The condition of the ternary operation is expected to be of type Bool and the two choices are expected to be sub-expressions with compatible types. The ternary operation is lazily evaluated. If the condition evaluates to true, then the result is the first choice, without the sub- expression for the second choice being evaluated. If the condition evaluates to false, then the result is the second choice, without the sub-expression for the first choice being evaluated.

Examples:

  • A simple ternary operation: 3<10?"smallerThan10":"notSmallerThan10"