Logic Operation - Branch

The Branch operation is used to perform a change of control with the operation sequence. By default, operations are executed in sequential order starting from operation index 0.

The branch operation allows looping and branching within the operations sequence.

Attributes

The operation attributes are as follows.

Attribute Type Description
type String eval
expression String [Required] The expression to evaluate, typically referencing $v, $i or $g.
This attribute is always evaluated as an expression.
on_true String Optional label of operation to jump to if the expression evaluates as true.
on_false String Optional label of operation to jump to if the expression evaluates as false.

Note: If the relevant on_true or on_false attribute is not configured, control will flow to the following operation.

Note: The on_true or on_false label names are static. They are never evaluated as expressions.

Note: The on_true and on_false attributes (if configured) must refer to a matching label on one of the operations. This check is performed at the start of the test run. The test run will not commence if the labels cannot be resolved.

Example

This is an example entry within the operations array:

{ 
    "type": "branch", 
    "expression": "$v->{threshold} > 10",
    "on_true": "increment3"
}