Conditions
Conditions are the checks that determine whether a rule passes or fails. They can be combined using logical operators.
Single Condition
Section titled “Single Condition”The simplest rule has one condition:
A **Person** is adult
if __age__ of **Person** is greater than or equal to 18.AND Conditions
Section titled “AND Conditions”Use and to require all conditions to be true:
A **Person** qualifies
if __age__ of **Person** is greater than or equal to 18
and __income__ of **Person** is greater than 50000
and __credit_score__ of **Person** is greater than 700.All three conditions must pass for the rule to pass.
Interactive Example
OR Conditions
Section titled “OR Conditions”Use or to require at least one condition to be true:
A **User** gets discount
if __age__ of **User** is greater than or equal to 65
or __is_student__ of **User** is equal to true
or __is_veteran__ of **User** is equal to true.Interactive Example
Mixed AND/OR
Section titled “Mixed AND/OR”You can mix and and or in a single rule:
A **Person** is eligible
if __age__ of **Person** is greater than 18
and __status__ of **Person** is equal to "active"
or __role__ of **Person** is equal to "admin".Optional Conditions: !and / !or
Section titled “Optional Conditions: !and / !or”The !and and !or operators work as alternative condition connectors. They provide a way to express optional conditions without changing the outcome if that branch fails.
A **Person** qualifies
if __age__ of **Person** is greater than 18
!and __status__ of **Person** is equal to "active".The !and operator behaves like an optional and. The !or operator behaves like an optional or.
Interactive Example
Use !and / !or when a condition should be evaluated if present, but should not force the rule to fail when that branch is not satisfied.
Condition Grouping
Section titled “Condition Grouping”Use parentheses to group conditions and control evaluation order:
A **Person** qualifies
if (__age__ of **Person** is greater than 18 and __verified__ of **Person** is equal to true)
or __role__ of **Person** is equal to "admin".Without grouping, conditions are evaluated left-to-right. Grouping makes the intent explicit when mixing and and or:
Interactive Example
Groups can also be negated:
A **Request** is blocked
if not (__token__ of **Request** is not empty and __token__ of **Request** starts with "Bearer").