cond
Execute a sequence of instructions depending on the value of a JavaScript condition.
The cond statement expects an array of conditions. Each condition is an object with a when and a then property, with the
exception of a single, optional condition with just an else property.
Properties
Properties for when-then conditions
cond[].when
The JavaScript condition to act on
cond[].then
Sequence of SWML Methods to execute when the condition evaluates to true
Properties for else condition
cond[].else
Sequence of SWML Methods to execute when none of the other conditions evaluate to true
The JavaScript condition string already has access to all the document variables. Using the variable
substitution operator (${var}) inside this string might result in inconsistent behavior.
Examples
Tell the caller what he’s calling from
Perform tasks based on user input
See Also
- Variables and Expressions: Complete reference for SWML variables, scopes, and using variables in conditional logic
- switch: Alternative conditional logic method