<switch>
<switch> compares one referenced string with ordered <case> values and falls back to one final <default>.
Why use it
Use it when a workflow has several named routes and exact, case-sensitive matching is clearer than a chain of boolean checks.
Common use cases
- Route by provider name.
- Select processing by status.
- Publish one stable result from several exact-string branches.
Syntax
WOML
<switch id="delivery" value="{{context.steps.order.provider}}">
<case value="express">
<step id="express"><script>return { days: 1 };</script></step>
<result value="{{context.steps.express}}" />
</case>
<default>
<step id="standard"><script>return { days: 5 };</script></step>
<result value="{{context.steps.standard}}" />
</default>
</switch>Rules and behavior
valueis required and must resolve to a string.- One or more unique non-empty
<case>arms and one final<default>are required. - Matching is exact, ordered, case-sensitive, and has no trim, coercion, or fallthrough.
- An ID-bearing switch requires one final
<result>in every arm. - An ID-less switch omits results and publishes no merged output.