op: if
Conditional branch — nested ops must be valid for the current phase.
Allowed phases
| Phase | Status |
|---|---|
preflight | ✓ allowed |
core | ✓ allowed |
side_effects | ✓ allowed |
Syntax
- op: if
expr: "entity.cart.total > 100"
then:
- op: set
path: /discount_rate
value: 10
else:
- op: set
path: /discount_rate
value: 0Parameters
| Field | Required | Description |
|---|---|---|
expr | yes | Condition expression string |
then | yes | Ops when truthy |
else | no | Ops when falsy |
Behavior
- Nested ops inside
then/elsemust respect phase constraints (e.g. nosetinside preflight). - Rule
when: { expr: "..." }uses an object wrapper; arraywhere:onfilter/remove/finddoes not.
Related operations
See also
- Operations index — all ops by phase
- actions — rule structure and phases
- Intents: Rules — narrative examples