ComfyUI Node

Input Switch

The if/else ComfyUI actually needed — and the lazy part is the whole point

By Stibo·Created 5 months ago·Updated 2 months ago· 9
Input Switch
  • on_true
  • on_false
  • output
boolean

Every ComfyUI user hits the wall eventually: you want "if this checkbox is on, use the SDXL model, otherwise use Flux," and stock ComfyUI gives you no way to say it. Nifty Input Switch from Nifty Nodes is that missing if/else - a boolean picks between two inputs of any type, and the version you actually want is the lazy one, because it doesn't run the branch you don't use.

That last bit is the whole trick. ComfyUI normally executes everything wired into the graph. So a naive switch that just picks one value still pays for the other branch to render, encode, or sample - which can mean wasted seconds or even an OOM on the branch you never wanted. Nifty Input Switch declares its inputs as lazy, so ComfyUI's own scheduler only evaluates the input that actually gets selected. Pick on_true and the model, latents, or images on on_false never run at all. That's the difference between "switching" and actually saving your VRAM.

The inputs that matter

  • boolean - the selector. Wire it to any BOOL: a toggle, a comparison node, or Nifty Is None.
  • on_true / on_false - the two candidates. Both are lazy (only the chosen one evaluates), and they accept any type, so the same switch works for MODELS, IMAGEs, LATENTs, CONDITIONING, or strings. At least one must be connected or the node complains.

Output: output - the chosen value, same type as the inputs.

Where you'll actually use it

Classic pattern: a boolean at the top of your workflow ("quick preview" toggle) that switches between a fast low-step sampler path and the full-quality path. Or conditional upscaling - if a face-detector found a region, pass the image through the detailer; otherwise skip it. The lazy evaluation is what makes these cheap: when the boolean flips, the dead branch just doesn't compute.

One trap to know: lazy means the unselected branch cannot produce side effects. If you were hoping the unselected path would still save a file or write metadata, use the Nifty Input Switch (Eager) variant instead, which always evaluates both sides.

Install

Nifty Nodes installs like any custom node pack. Easiest is ComfyUI Manager: search "Nifty Nodes" and install. Or from a terminal:

cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes

Restart ComfyUI. The pack is built on ComfyUI's new v3 API (comfy_api.latest), so it needs a reasonably current ComfyUI build - if the nodes don't appear in search, update ComfyUI first.

This is a young pack (v2.1.0, mid-2026) with a small community footprint so far, but it's well-documented and the logic suite here is the part you'll reach for daily. Install it, wire a toggle to an Input Switch, and the "but what if I want both workflows?" problem quietly disappears.

Categorynifty/logic

Inputs (3)

NameTypeDefaultDescription
booleanBOOLEANDetermines which input is passed to the output.
on_trueoptCOMFY_MATCHTYPE_V3Value passed through when boolean is True. Only evaluated if actually selected (lazy).
on_falseoptCOMFY_MATCHTYPE_V3Value passed through when boolean is False. Only evaluated if actually selected (lazy).

Outputs (1)

NameTypeDescription
outputCOMFY_MATCHTYPE_V3