Nodes/duckcomfy personal nodes/C Switch Boolean Float
ComfyUI Node

C Switch Boolean Float

Pick one of two numbers with a checkbox

By duckcomfy·Created about a year ago·Updated 10 months ago· 0
C Switch Boolean Float
    • float
    on_true
    on_false
    booleantrue

    C Switch Boolean Float is an A/B switch for a single number. You feed it two FLOAT values - on_true and on_false - and a boolean decides which one comes out the float output. Denoise 1.0 vs 0.5, CFG 7 vs 3.5, a scale factor for one pass vs another: one checkbox, two regimes, zero re-wiring.

    It belongs to the pack's little family of typed boolean switches (there are also conditioning and latent versions), and the float one is the workhorse because floats are everywhere. The classic use is toggling between a txt2img and an img2img pass: the same boolean that switches your latent source also flips your denoise from 1.0 down to 0.5, and both read from one checkbox so they can't disagree.

    The inputs that matter

    • on_true - the FLOAT used when the boolean is on.
    • on_false - the FLOAT used when it's off.
    • boolean - the selector, default on.
    • Output float - whichever input won.

    Three inputs, one output, that's the whole node. The neat part is that both float inputs are marked lazy: ComfyUI only executes the upstream branch you actually select. The losing branch isn't computed at all, so you can attach expensive float-producing nodes (an image-measuring node, a conditional computation) to both sides without paying for the one you don't use.

    Why you'd use this instead of a converter

    You could achieve the same routing by converting a widget to input and switching it yourself, but a named switch keeps the choice visible and re-usable. Wire the same boolean into several switches - float, latent, conditioning - and one checkbox flips an entire mode of the workflow. It reads cleanly on a shared graph too: "CFG low" vs "CFG high" labeled as inputs is easier to audit than a bare number.

    Install

    Part of duckcomfy personal nodes. ComfyUI Manager → search "duckcomfy personal nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/duckcomfy/duckcomfy_personal_nodes
    

    Restart ComfyUI. No pip dependencies, no downloads; the pack is a personal grab-bag and this family of switches is one of its more genuinely useful additions.

    Gotchas

    Because the unselected input is lazy, you can leave on_false completely unwired and nothing breaks - but only if boolean is on. If you then flip it off, ComfyUI errors at runtime because the now-needed input is missing. So if you build a graph where the losing branch is intentionally empty, lock the boolean or wire both sides. Also note the output is a plain float with no history: whatever you switch to is what downstream samplers use, so double-check the sampler isn't also holding its own widget value for the same parameter - the switch only wins if the sampler is actually reading from it.

    Categoryduckcomfy

    Inputs (3)

    NameTypeDefaultDescription
    on_trueFLOAT
    on_falseFLOAT
    booleanBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    floatFLOAT