Nodes/ComfyMath/BoolBinaryOperation
ComfyUI Node

BoolBinaryOperation

AND, OR, XOR and friends for two booleans

By evanspearman·Created 3 years ago·Updated about a year ago· 192
BoolBinaryOperation
    • BOOLEAN
    op
    afalse
    bfalse

    BoolBinaryOperation is basic logic-gate math: feed it two booleans, pick a gate, get one boolean back. If you've ever built a spreadsheet formula with AND()/OR(), or written an if condition1 and condition2 in code, this is the same idea dropped into the graph - useful the moment your workflow needs to act on two conditions being true at once rather than just one.

    How it works

    Pick a gate from op - the full set is Nor, Xor, Nand, And, Xnor, Or, Eq, Neq, eight in total. And/Or are the ones you'll reach for most; Xor is true when exactly one input is true (not both); the N-prefixed ones (Nand, Nor, Xnor) are just the inverse of their base gate; Eq/Neq check whether the two booleans match. Feed a and b, get the result.

    The inputs and outputs that matter

    • op - the gate dropdown.
    • a, b - the two boolean operands (default false).
    • Output - a single BOOLEAN, the result of the gate.

    Installing it

    Search ComfyMath in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes && git clone https://github.com/evanspearman/ComfyMath
    

    then restart ComfyUI. No pip dependencies beyond ComfyUI's own, no models to download.

    Common issues

    The main thing beginners trip on with any boolean-logic node in ComfyUI isn't the logic itself, it's that a resulting true/false doesn't automatically do anything - ComfyMath's own line-up doesn't include a general switch/branch node. You need something downstream built to consume a boolean and route execution or values based on it, like rgthree-comfy's Any Switch. Wire this into something that expects a plain BOOLEAN, and it works; wire it into a plain execution flow expecting a branch and nothing happens, because there's no branching mechanism here - just the decision.

    If you're feeding this from other ComfyMath nodes, remember booleans, ints, and floats are separate socket types in this pack the same way NUMBER is: a BoolToInt output is an INT, not a BOOLEAN, so it won't plug back into this node's a/b without converting again.

    This is one of the lower-traffic nodes in an already quiet pack, so there's not much community troubleshooting history to point to if something goes wrong - the logic itself is simple enough to verify by hand, though, which is the advantage of a node this small. ComfyMath overall hasn't had active maintenance since roughly early 2024 by community accounts, but as dependency-free arithmetic with no model weights involved, that's had little practical effect on the nodes people actually use day to day.

    Categorymath/bool

    Inputs (3)

    NameTypeDefaultDescription
    opCOMBO8 options: Nor, Xor, Nand, And, Xnor, Or, +2
    aBOOLEANfalse
    bBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN