image.png

In Flow Core, If-Else is not “writing a piece of if code.” It is a flow-control routing node. Its responsibility is very simple: it evaluates multiple condition groups in order, routes the flow chain to the first matching output, and if none of them match, execution goes to Else.

In the menu, it appears as the If-Else node. When first created, it includes the default ports In, True #0, and Else. Under the hood, it uses the FlowIfGroup data structure. Each group contains Enabled, Expanded, Comment, Condition Mode, and Conditions. ConditionMode supports:

Mechanism

At runtime, the editor-side If Groups are first compiled into FlowRuntimeIfGroup[], while Else Next is resolved separately. This means the core role of If-Else is not to “execute instructions,” but to compile condition groups into a set of target outputs.

During actual execution, ExecuteIfElseNode first handles the busy / gate logic, then evaluates each enabled group in order. Disabled groups are skipped immediately. The first group whose result evaluates to true returns its corresponding True Next. If no group passes, execution returns Else Next.

Key Points:

One implementation detail is worth noting: although the FlowIfGroup structure includes a Reject Result field, the If-Else UI does not expose it, and the If-Else runtime compiler does not use it. That field mainly exists for reuse in other contexts, such as Guard or BT.

UI

The If-Else node summary displays Groups: X | Conditions: Y, which gives you a quick overview at a glance.