ComfyUI Node

Int Switch

The 2-in-1 integer switch

By Stibo·Created 5 months ago·Updated 2 months ago· 9
Int Switch
    • INT
    booleantrue
    on_true0
    on_false0

    Nifty Int Switch is the smallest useful idea in the Nifty Nodes logic suite: a boolean chooses between two integer values. True returns on_true, False returns on_false, done. It looks almost too trivial to install a pack for - then you realize how often you hand-type the same two numbers depending on a toggle.

    Typical case: one checkbox at the top of your workflow says "quick preview." When it's on, you want 8 steps and batch size 1; when it's off, 30 steps and batch 4. That's two Int Switches, each fed by the same boolean, doing the work you'd otherwise do by editing nodes mid-run. Same trick works for seeds, CFG values, empty-latent dimensions, or any of the dozens of INT inputs scattered through a graph.

    The inputs that matter

    • boolean - the selector (default True).
    • on_true - the integer returned when the boolean is True.
    • on_false - the integer returned when the boolean is False.

    Output: INT, the selected value.

    Nothing else is going on here - there's no lazy/eager dimension because both values are just widgets, evaluated trivially. The whole point is convenience: wire a boolean in once and all the integers downstream follow it. Drive the boolean from a toggle, a comparison, or Nifty Is None, and you've got configurable workflows without touching a node.

    Notes and gotchas

    • The number ranges are huge (the full int64 span), so it handles any INT input you throw at it.
    • If you're switching floats, grab Nifty Float Switch instead - different type, same idea.
    • If the values you're switching are real data (an INT coming out of another node, not a literal you typed), don't use this - use the generic Nifty Input Switch, which routes any type by boolean and is lazy to boot.

    Install

    Nifty Nodes is a young, v3-API pack. Install via ComfyUI Manager (search "Nifty Nodes") or:

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

    Restart ComfyUI. No extra dependencies for this one - it's pure widget switching. Not a headline feature, but it's the kind of node that quietly disappears into your workflow and makes everything else a little more adjustable.

    Categorynifty/logic

    Inputs (3)

    NameTypeDefaultDescription
    booleanBOOLEANtrueDetermines which integer value is returned.
    on_trueINT0-9223372036854776000–9223372036854776000Returned when boolean is True.
    on_falseINT0-9223372036854776000–9223372036854776000Returned when boolean is False.

    Outputs (1)

    NameTypeDescription
    INTINT