> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-recommend-assets-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ComfySwitchNode - ComfyUI Built-in Node Documentation

> Complete documentation for the ComfySwitchNode node in ComfyUI. Learn its inputs, outputs, parameters and usage.

> 本文档由 AI 生成。如果您发现任何错误或有改进建议，欢迎贡献！ [在 GitHub 上编辑](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/ComfySwitchNode/zh.md)

Switch 节点根据布尔条件在两个可能的输入之间进行选择。当 `switch` 启用时，它输出 `on_true` 输入；当 `switch` 禁用时，它输出 `on_false` 输入。这允许你在工作流中创建条件逻辑并选择不同的数据路径。

## 输入参数

| 参数         | 数据类型        | 必填 | 范围 | 描述                                                                         |
| ---------- | ----------- | -- | -- | -------------------------------------------------------------------------- |
| `switch`   | BOOLEAN     | 是  |    | 一个布尔条件，用于决定传递哪个输入。当启用（true）时，选择 `on_true` 输入。当禁用（false）时，选择 `on_false` 输入。 |
| `on_false` | MATCH\_TYPE | 否  |    | 当 `switch` 禁用（false）时传递给输出的数据。仅当 `switch` 为 false 时才需要此输入。                 |
| `on_true`  | MATCH\_TYPE | 否  |    | 当 `switch` 启用（true）时传递给输出的数据。仅当 `switch` 为 true 时才需要此输入。                   |

**关于输入要求的说明：** `on_false` 和 `on_true` 输入是条件性必填的。节点仅在 `switch` 为 true 时请求 `on_true` 输入，仅在 `switch` 为 false 时请求 `on_false` 输入。两个输入必须是相同的数据类型。

## 输出

| 输出名称     | 数据类型        | 描述                                                                                    |
| -------- | ----------- | ------------------------------------------------------------------------------------- |
| `output` | MATCH\_TYPE | 被选中的数据。如果 `switch` 为 true，则输出 `on_true` 输入的值；如果 `switch` 为 false，则输出 `on_false` 输入的值。 |
