Nodes/NH-Nodes/Any Switch (NH)
ComfyUI Node

Any Switch (NH)

The Any Switch (NH) that isn't the fallback you were promised

By jetthuangai·Created 5 months ago·Updated 21 days ago· 6
Any Switch (NH)
  • input_true
  • input_false
  • result
  • condition
conditiontrue

Here's a naming trap worth knowing about before it bites you. In rgthree's world, "Any Switch" means a first-non-null fallback: it walks its inputs and passes the first one that isn't empty, with no selector to touch. This node is also displayed as "Any Switch (NH)" - but it's the other kind of switch entirely. It's an A/B selector driven by a boolean condition, and it picks between exactly two inputs. Same family, completely different behavior.

If you came here expecting fallback behavior, that's the single most important sentence in this article. Use this node when you have a real condition and two competing values; don't use it to mean "pass whichever branch is live."

How it works

condition (a BOOLEAN) decides: true → input_true wins, false → input_false wins. The result comes out the single result output, and condition is passed through as a second output so you can chain decisions without re-wiring your boolean.

The part that makes it worth choosing over a hand-built equivalent is lazy evaluation. Both inputs are declared lazy, and the node tells ComfyUI which one it actually needs before anything runs. Wire a whole expensive sampler branch into input_true and a cheap one into input_false - when the condition is false, the expensive branch doesn't execute at all. That's real compute saved, not just tidy wiring.

When to reach for it

  • Flipping between two models, two samplers, or two prompts with a toggle.
  • Building a "compare mode" workflow: an If/Else (NH) or Compare (NH) upstream produces the condition, and this node routes the data.
  • Anywhere the two branches are expensive enough that you care which one runs.

The honest alternative: for the first-non-null job, use a dedicated fallback node instead (rgthree's Any Switch, or NH's own Switch N (NH) if you need index-based picking). This node's whole personality is the boolean selector, and trying to bend it into a fallback will just confuse you later.

Installing

Same pack, same one-time setup:

cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
pip install -r requirements.txt

Or install NH-Nodes via ComfyUI Manager and restart. No models, no downloads - this is pure graph logic.

CategoryNH-Nodes/Logic

Inputs (3)

NameTypeDefaultDescription
conditionBOOLEANtrue
input_true*
input_false*

Outputs (2)

NameTypeDescription
result*
conditionBOOLEAN