Nodes/ComfyUI 1hewNodes/Int Number Compare
ComfyUI Node

Int Number Compare

Compare two integers and get a real boolean out of it

By 1hew·Created about a year ago·Updated 8 days ago· 33
Int Number Compare
    • bool
    a0
    operator==
    b0

    For a tool that runs on a graph, ComfyUI has surprisingly few ways to make a decision. Int Number Compare (1hew_IntNumberCompare) is one of the honest ones: take two integers, run one of six comparison operators, and get a BOOLEAN you can wire into a switch or a condition. No drama, no hidden state - it's the integer side of the compare family that also includes Float Number Compare in the same pack.

    You'll reach for it the first time you want a workflow to react to a number instead of blindly plowing ahead: "if my batch has more than four frames, do the expensive pass," "if this file count is zero, stop."

    How it works

    The node takes a, b, and an operator combo: ==, !=, >, >=, <, <= (default ==). It evaluates and outputs bool. That's the whole mechanism - the implementation is a six-way if-statement, which is exactly as complicated as this should be. Both integers accept a huge range (±999,999,999), so it's not going to overflow on anything you throw at it.

    Inputs and outputs

    • a - first integer.
    • operator - the comparison, default ==.
    • b - second integer.
    • bool - the BOOLEAN result.

    Installing it

    It's part of the 1hewNodes pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/1hew/ComfyUI-1hewNodes
    

    or via ComfyUI Manager ("1hewNodes"), then restart. No dependencies beyond the pack's base set.

    Where it actually gets used

    The output is a BOOLEAN, and the natural destination is the pack's Any Switch Bool - the lazy branch router that only evaluates the chosen path. Chain them: Get File CountInt Number Compare (count > 0) → Any Switch Bool, and you've built an empty-folder guard with three nodes. Or use it with frame counts from a video loader to decide whether to run a keyframe pass.

    Two small notes. The default operator is ==, which is the least useful default for most gating (you'll usually want > or >=), so remember to change it. And floating-point output from other nodes needs the Float Number Compare sibling instead - this one casts to int, so a 1.9 would truncate before comparing, which is a silent off-by-one bug waiting to happen. Keep ints on this node and you'll be fine.

    Category1hewNodes/logic

    Inputs (3)

    NameTypeDefaultDescription
    aINT0-999999999–999999999
    operatorCOMBO==6 options: ==, !=, >, >=, <, <=
    bINT0-999999999–999999999

    Outputs (1)

    NameTypeDescription
    boolBOOLEAN