ternary

The ternary function takes two values, and a test value. If the test value is true, the first value will be returned. If the test value is empty, the second value will be returned. This is similar to the c ternary operator.

ternary "foo" "bar" true

or

true | ternary "foo" "bar"

The above returns "foo".

ternary "foo" "bar" false

or

false | ternary "foo" "bar"

The above returns "bar".

Back to top