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

# ComfySoftSwitchNode - ComfyUI Built-in Node Documentation

> Soft Switch 节点根据布尔条件在两个可能的输入值之间进行选择。

Soft Switch 节点根据布尔条件在两个可能的输入值之间进行选择。当 `switch` 为 true 时，它输出 `on_true` 输入的值；当 `switch` 为 false 时，输出 `on_false` 输入的值。此节点采用惰性设计，意味着它仅根据 `switch` 状态评估实际需要的输入。

## 输入

| 参数         | 描述                                                                      | 数据类型        | 必需 | 范围                   |
| ---------- | ----------------------------------------------------------------------- | ----------- | -- | -------------------- |
| `switch`   | 用于确定传递哪个输入的布尔条件。当为 true 时，选择 `on_true` 输入。当为 false 时，选择 `on_false` 输入。  | BOOLEAN     | 是  | True or False        |
| `on_false` | 当 `switch` 条件为 false 时要输出的值。此输入为可选，但 `on_false` 或 `on_true` 中至少有一个必须连接。 | MATCH\_TYPE | 否  | 与 `on_true` 相同的数据类型  |
| `on_true`  | 当 `switch` 条件为 true 时要输出的值。此输入为可选，但 `on_false` 或 `on_true` 中至少有一个必须连接。  | MATCH\_TYPE | 否  | 与 `on_false` 相同的数据类型 |

**注意：** `on_false` 和 `on_true` 输入必须具有相同的数据类型，具体由节点的内部模板定义。这两个输入中至少有一个必须连接，否则节点将返回验证消息 "At least one of on\_false or on\_true must be connected to Switch node"。由于该节点采用惰性求值，当仅连接一个输入时，无论 `switch` 状态如何，节点始终输出该输入的值。

## 输出

| 输出名称     | 描述                                                                                                                          | 数据类型        |
| -------- | --------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `output` | 选定的值。它与已连接的 `on_false` 或 `on_true` 输入的数据类型匹配。当两个输入都连接时，如果 `switch` 为 true，则输出 `on_true`；如果 `switch` 为 false，则输出 `on_false`。 | MATCH\_TYPE |

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

***

**Source fingerprint (SHA-256):** `7bf4bed69d8fd8c360e971ab8068382cd8ebaa02004d5df44312977a7309ae00`
