Guards Syntax
Syntax patterns for conditional logic.
Single Guard
flow
? condition
// runs if trueMultiple Guards (AND)
flow
? condition1
? condition2
// runs if BOTH trueOR Guards
flow
? condition1
?? condition2
// runs if EITHER trueCombined Logic
flow
? conditionA
? conditionB
?? conditionC
// runs if (A AND B) OR CDefault Case
flow
? condition1
handle 1
? condition2
handle 2
otherwise
handle defaultOr:
flow
? condition
handle condition
?
handle elseNested Guards
flow
? outer condition
? inner condition
// nested action
otherwise
// inner else
otherwise
// outer elseGuard Patterns
State Checks
flow
? order is in #pending
? order is not in #cancelledContext Comparisons
flow
? $total equals 100
? $total is 100
? $total is greater than 0
? $total is less than 1000
? $items contains "Laptop"
? $items is empty
? $items is not emptyAssertion Patterns
flow
expect:
// State assertions
= order is in #paid
= order is not in #cancelled
// Context assertions
= $total equals 1200
= $items contains "Laptop"
= $count is greater than 0
// Event assertions
= @customer received :confirmation
= :payment_request was emitted to @payment