Conditional is very similar to omif : it tests if a set of conditions is fulfilled, one by one. As soon as one condition is fulfilled, conditional executes the corresponding operation.
Its behaviour can be summed up as :
"IF condition A is fulfilled, THEN return x, ELSE check if condition B is fulfilled.
IF condition B is fulfilled, THEN return y, ELSE check if condition C is fulfilled.
IF condition C is fulfilled..."
The conditional box can be accessed via the Functions / Control / CONDITIONAL
menu.
The conditional box takes a number of test arguments. It has one default input and output and a free number of additional inputs.
Its output returns the value of the last evaluated input. All inputs are test inputs : predicates, or other types of boxes. |
Conditional behaves like an or operator.
The box evaluates its inputs successively until an input returns a non nil value.
This value is returned by conditional.
Conditional can be used as a meta-omif box, with a virtually unlimited number of "if" / "then" and "else" inputs, and a terminal "else" input.
Each input can take an omif box representing a condition and an action. Because conditional stops the inputs evaluation as soon as it gets a non nil value, these actions are linked with each other in a causal chain.
In this example, we will test successively if 4 = 5, and define a last argument for conditional.
|
In this example, we want to filter values from 1 to 10 and pass 1, 7, 9 or 10.
|