Nodes/More Math/Int -> bool
ComfyUI Node

Int -> bool

Turn a computed number into a real true/false switch

By mcDandy·Created about a year ago·Updated 3 days ago· 5
Int -> bool
    • BOOLEAN
    value0

    ComfyUI's boolean inputs don't accept numbers, and that's exactly the gap this node fills. Int -> bool takes an integer and hands back a BOOLEAN - the type that toggles things on and off. Use it when you want a decision your graph made (a comparison, a computed flag, a seed-derived choice) to flip a node's boolean switch for you.

    How it works

    It's Python's bool(value) in a box: any non-zero integer becomes True, zero becomes False. So 5 → true, 0 → false, -3 → true. There's no threshold, no "truthy string" parsing - if it isn't exactly zero, it's on.

    The reason it exists at all is ComfyUI's strict wiring. You can't drag an INT wire onto a boolean socket - the graph will refuse the connection. If you want a computed condition to control something like a node's "enabled" or "use this branch" input, you need the conversion to happen explicitly. This is that conversion.

    Inputs and output

    • value - an INT, default 0.
    • Output - a BOOLEAN.

    That's the whole node. One input, one output, nothing to configure. It's the bool half of the pack's conversion family: Float -> Int, Int -> Float, Bool -> Int, and this one. If you're coming at it from the other direction, Bool -> Int (also in the pack) gives you 0/1.

    Installing it

    Part of More Math (mcDandy/more_math). ComfyUI Manager: search "More Math". Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mcDandy/more_math
    cd more_math
    pip install -r requirements.txt
    

    Restart after. Dependencies: antlr4-python3-runtime and torch only - nothing to download. One shared gotcha with the whole pack: it needs a recent ComfyUI (newer node API), so update ComfyUI if the nodes don't appear.

    Any gotchas?

    The only trap is assuming it's a threshold. It's not: 2 is just as true as 42. If you need "true only when the value is big enough," compute the comparison in a math node first (a >= 5 evaluates to 1 or 0 in this pack's expression language) and convert that. Trivial node, but it saves you a manual toggle every time your workflow grows a computed branch.

    CategoryMore math

    Inputs (1)

    NameTypeDefaultDescription
    valueINT0

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN