Conditional

Route data flow based on a boolean condition.

What it does

Conditional picks between two values based on a boolean condition, a graph-native if/then/else. The condition is evaluated once and applied the same way to every channel. Any non-zero number, non-empty string, non-empty list or true boolean counts as true; zero, empty or false counts as false.

One condition can drive up to 8 independent channels. Raise Channels to add more if-true / if-false pairs, each with its own result output. Each channel passes whatever it is fed through as-is: an image stays an image, a list of points stays a list of points, with no resampling or reshaping.

When to use it

ParameterTypeDefaultWhat it does
conditionAny—Boolean condition (truthy: non-zero, non-empty)
channelsNumber1Number of independent channels (1-8)
if_true_0Any—Channel 0 value when condition is true
if_false_0Any—Channel 0 value when condition is false
if_true_1Any—Channel 1 value when condition is true
if_false_1Any—Channel 1 value when condition is false
if_true_2Any—Channel 2 value when condition is true
if_false_2Any—Channel 2 value when condition is false
if_true_3Any—Channel 3 value when condition is true
if_false_3Any—Channel 3 value when condition is false
if_true_4Any—Channel 4 value when condition is true
if_false_4Any—Channel 4 value when condition is false
if_true_5Any—Channel 5 value when condition is true
if_false_5Any—Channel 5 value when condition is false
if_true_6Any—Channel 6 value when condition is true
if_false_6Any—Channel 6 value when condition is false
if_true_7Any—Channel 7 value when condition is true
if_false_7Any—Channel 7 value when condition is false

Gotchas

Only the first channel's Result is always present. Result 1 and beyond appear once Channels is raised, so set it to the number of pairs in use.

An unconnected branch reads as 0, or the equivalent empty value for its type, not as unset. Wire both the true and false side of a channel to avoid a silent zero.

Both branches of a channel should carry the same kind of value. Where they differ, the true branch's type wins for the result.

Worked example

  1. Add a Conditional node and wire a boolean or a Compare result into Condition.

  2. Wire the two candidate values into If True and If False for channel 0.

  3. Connect Result to whatever should receive the chosen value.

  4. To switch more than one thing at once, raise Channels, fill in the new If True / If False pair(s) and take their Result output.

See also

Compare · Logic · Router · Automatic conversion