Use the If node to branch a graph based on a Boolean condition. Only the matching branch runs. The other branch's nodes don't run at all. For a full explanation of this behavior, see Conditional logic.
Click Add node
on the toolbar or press Space.
The Add node dialog opens.
Search for If and select it from the Base package.
The If node is placed on the canvas with three input ports (Condition, True Value, False Value) and one output port (Result).
The Condition port accepts a Boolean value (true or false). Wire it from any node that produces a Boolean output.
Add a node that produces a Boolean. For example, add a Compare node from the Base package.
Wire the Boolean output to the Condition port on the If node.
Wire the output of the node that produces the value you want when the condition is true to the True Value port. This is often the final node of a branch of several connected nodes that compute the true-case result.
Wire the output of the node that produces the value you want when the condition is false to the False Value port. Similarly, this can be the end of a separate branch of nodes computing the false-case result.
Only the branch matching the condition is evaluated when the graph runs. Nodes on the branch that didn't run are skipped entirely. After the run, the Diagnostics tab lists entries only for the nodes that ran; the skipped branch is absent from the list.
Wire the Result port to any downstream node that needs the value.
Result carries the output of whichever branch was taken.
Some nodes, such as pure flow nodes, don't expose a data output port that can connect to True Value or False Value. Use a Repeat node as a bridge in those cases.
See Use the Repeat node for steps.