Nodes/ComfyUI-Beyond_nodes/Boolean Switch Any Type 🦾
ComfyUI Node

Boolean Switch Any Type 🦾

The any-type switch that skips the branch you didn't pick

By beyondprompting·Created 9 months ago·Updated 7 months ago· 0
Boolean Switch Any Type 🦾
  • on_true
  • on_false
  • *
booleantrue

Boolean Switch Any Type is the A/B switch you reach for when a workflow needs to swap between two things - two prompts, two images, two LoRA stacks, two samplers - without rewiring a graph every time. You wire in both options, toggle one boolean, and the winner comes out the other side.

What sets it apart from the pack's other switches is the lazy evaluation. The node tells ComfyUI "only execute the branch I actually selected," so the path you didn't choose never runs. That's not a footnote: if your two options are an expensive tiled upscale and a plain resize, the loser doesn't burn GPU time or hit a missing model error. A dumb switch would compute both and throw one away. This one doesn't.

How it works

The inputs are any-typed (*), meaning the node accepts images, latents, strings, tensors, whatever you attach. boolean decides: true routes on_true to the output, false routes on_false. The node implements ComfyUI's check_lazy_status, which is how it tells the executor which of the two inputs it needs - the mechanism behind not running dead branches.

One honest caveat: lazy inputs only skip execution when the unselected branch isn't already cached from a previous run. In a freshly-loaded workflow the bypassed branch genuinely doesn't execute; on a rerun with everything cached it's mostly a no-op anyway.

The inputs that matter

  • on_true (required, any type) - what comes out when boolean is true.
  • on_false (required, any type) - what comes out when boolean is false.
  • boolean (required, default true) - the switch itself.

Output: one any-typed value, the selected branch.

Install

This is a member of the ComfyUI-Beyond_nodes pack, so it installs with the rest of it. ComfyUI Manager → search "Beyond_nodes" → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/beyondprompting/ComfyUI-Beyond_nodes

Restart ComfyUI. No extra dependencies - this node is pure Python against ComfyUI's own types.

Common issues

  • My boolean is a widget, not a socket. You can connect a boolean from a Compare node or a Bool primitive if you want the switch driven dynamically. A plain toggle widget is fine when you're just A/B testing by hand.
  • The output socket looks untyped. Yes - any-typed outputs show as wildcard until you connect something. That's normal, not a bug.
  • I want more than two options. This node is binary by design. For 3+ way routing, look at a multi-select switch or the pack's ImageMaskSwitch for the image-specific case.

If you mostly switch between two images or two latents, this is the one to reach for. It's also a tidy way to make a "mode" flag - choose between high-res and draft settings with a single checkbox.

CategoryBeyond Nodes/Logic

Inputs (3)

NameTypeDefaultDescription
on_true*
on_false*
booleanBOOLEANtrue

Outputs (1)

NameTypeDescription
**