If [Help Patch]

Conditional if/then/else statement.

Syntax

If predicate-expr then consequent-expr [ else alternative-expr ]

Inlets

   The number and types of inlets depends on the expressions used.

Outlets

Comments

Predicate-expr, consequent-expr and alternative-expr are mathematical expressions with the same features and functionality as those used by Expr. The only additional constraint is that predicate-expr must evaluate to a boolean value. Whenever a new value is received via any inlet of an If transform (i.e., one of the expression variables changes), predicate-expr is evaluated. If it evaluates to true, then consequent-expr is evaluated and the result is sent out the consequent outlet. Otherwise alternative-expr is evaluated and the result is sent out the alternative outlet. If no alternative-expr is provided, no action is taken when the predicate is false.

The If transform always routes true results to consequent and false results to alternative. If you want to route both results to the same place, connect both outlets of If to a FanIn transform.

See Also

Expr
FanIn
Switch