ComfyUI Node

NAND

The gate nobody needs until they do

By danipisca07·Created 6 months ago·Updated 6 months ago· 0
NAND
    • BOOLEAN
    afalse
    bfalse

    NAND is short for "NOT AND," and the truth table is the whole node: it returns False only when both inputs are True, and True in every other case. If you've ever done anything with digital logic, that'll sound familiar - NAND is the "universal gate," the one you can build every other gate out of. In a ComfyUI workflow you probably won't be building full adders, but knowing it's there for the occasional inverted condition is worth the two seconds of reading this.

    When you'd actually use it

    The honest answer: rarely, at first. Most beginner workflows only ever need AND, OR, and NOT - which, conveniently, this same pack also ships. NAND earns its keep when you want to express "proceed as long as it's not the case that both of these are true."

    Concrete example: you have a guard that should let a re-generate pass through unless two failure flags are both set - say, a face-detector found nothing and a sharpness check failed. Wire those two booleans into a NAND, and the output is False exactly when you want to block. It reads as "if not (A and B)." Same effect as chaining an AND into a NOT, but one node instead of two.

    How it works

    The implementation is Python's not (a and b) - two boolean inputs, one boolean output, no hidden state, no dependencies. The author's description puts it plainly: "Returns False only if both inputs are True (NOT AND)." It's in the SimpleLogics/Logic category alongside OR, NOT, XOR, and NOR.

    The inputs that matter

    Both are required BOOLEAN inputs, both default to False:

    • a - first boolean
    • b - second boolean

    One BOOLEAN output. Wire it into any switch node's condition socket or chain it into other logic - booleans are the connective tissue of conditional workflows.

    Installing it

    Like every node in this pack, NAND comes from danipisca07/ComfyUI-SimpleLogics - a small pure-Python pack by Daniele Piscaglia with no requirements.txt and no models. Install via ComfyUI Manager (search "SimpleLogics") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/danipisca07/ComfyUI-SimpleLogics
    

    Then restart ComfyUI. Nothing to pip-install, nothing to download.

    Common issues

    There's no real failure mode here - it's a boolean gate, and booleans are about as forgiving as data gets. The only confusion is conceptual: if you're expecting "both true → true" you've got the wrong node, because that's plain AND. Double-check which one you grabbed when a workflow's logic seems backwards. And one pack quirk to file away: installing SimpleLogics also registers an undocumented GeoCalib-to-fSpy camera node, so ignore that. Keep the pack updated with git pull and move on.

    CategorySimpleLogics/Logic

    Inputs (2)

    NameTypeDefaultDescription
    aBOOLEANfalse
    bBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN