switch
Execute different instructions based on a variable’s value
Properties
switch
An object that accepts the following properties.
switch.variable
Name of the variable whose value needs to be compared.
switch.case
Case_params object of key-mapped values to array of SWML Methods to execute.
switch.default
Array of SWML Methods to execute if no cases match.
case_params
The case_params object serves as a dictionary where each key is a string identifier, and
the associated value is an array of SWML Method objects.
case.property_name
Name of the variable whose value needs to be compared.
Examples
See Also
- Variables and Expressions: Complete reference for SWML variables, scopes, and using variables in conditional logic
- cond: Alternative conditional logic method