> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/flow-logic/splitting.md).

# 在 Duaer 里用 If 和 Switch 分叉

在 Duaer 里，If 把每条数据分到 true 或 false。Switch 按规则或表达式分到多个出口。
## 两条路用 If

1. 在节点面板搜索 If，接到上一个节点后面。
2. 加一条条件。例如字符串字段 status 等于 paid。
3. 多条条件用 AND 或 OR 组合。
4. true 出口接要继续的步骤，false 出口接另一条，或留空。

每条数据单独判断。10 条里 3 条满足，true 出口出去 3 条，false 出口出去 7 条。

## 多条路用 Switch

Switch 的模式有两种：

- Rules：为每个出口写匹配规则。没匹配上的可以丢掉，或送到一个额外出口。
- Expression：写表达式，返回出口序号，从 0 开始。

两条路够用时用 If。要按优先级、状态或类型分成三路以上时用 Switch。
## Questions

### Duaer 的 If 会把整批数据只走一边吗？

不会。每条数据单独判断，true 和 false 可以同时有数据。

