FEEL

if … then … else

FEEL language construct

if condition then expression else expression

The conditional expression. Unlike an if statement in a programming language it is an expression: it always yields a value, so the else branch is mandatory. The condition must evaluate to a boolean; anything else (including null, a common cause of surprising decisions) takes the else branch.

Syntax elements

ElementTypeDescription
conditionbooleanthe test; a non-boolean result selects the else branch
thenanyvalue if the condition is true
elseanyvalue otherwise; not optional

Examples

if 5 > 3 then "yes" else "no"
if null then "a" else "b"
if 1 > 2 then "a" else if 2 > 1 then "b" else "c"
if {age: 34}.age >= 18 then "adult" else "minor"

Related constructs

null and error propagation · comparison and boolean operators

Related functions

not

Defined by the OMG DMN 1.6 specification, chapter 10.3 (the FEEL grammar and semantics).