ComfyUI Node

nand

The gate nobody needs, for when you need the gate

By StableLlama·Created about a year ago·Updated about 20 hours ago· 48
nand
    • BOOLEAN
    input1false
    input2false

    Let's be honest about the crowd this node is for: nand exists to complete the set. You will almost never build a workflow around it, and if you squint, it's just and followed by not. But it's here - part of Basic data handling, StableLlama's zero-dependency pack - and knowing what it does costs you one sentence: NAND is true in every case except when both inputs are true. It's "not (A and B)."

    In the real world, people reach for the pack's and + not combo instead, because two named nodes read more clearly in a graph than one NAND. But there are two honest reasons to use NAND directly: if you're porting logic from a circuit design or a truth-table (NAND is a universal gate, so it shows up in hobbyist logic), or if you want to save a node and your graph is dense enough that clarity is already lost anyway. For most of us, it's the node you'll stumble across while searching for and, read this article, and not use.

    How it works

    Both inputs must be BOOLEAN. The output is the exact negation of AND: true unless input1 and input2 are both true. So with both inputs false, NAND is true; with one true, NAND is true; with both true, NAND is false. In Python it's not (input1 and input2). Nothing subtle.

    The inputs and the output

    • input1 (BOOLEAN, default False)
    • input2 (BOOLEAN, default False)
    • BOOLEAN (output) - true unless both inputs are true.

    Same shape as every two-input logic node in the pack, so you can wire it into the same trees.

    Installing it

    Install Basic data handling from ComfyUI Manager (search the pack title), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
    

    Restart ComfyUI. No dependencies, no model files.

    Troubleshooting

    • "I keep confusing NAND and NOR." NAND is the AND one - "not AND" - true unless both are true. NOR is "not OR" - true only when both are false. Think of the letter that follows the N: NAND = negated AND, NOR = negated OR.
    • "I wanted 'either one but not both'." That's XOR, not NAND. If you actually want a difference check, use the pack's xor node.
    • When in doubt, decompose. andnot gives you identical behavior and a graph that explains itself. NAND is for when you know exactly why you're using it.
    CategoryBasic/BOOLEAN

    Inputs (2)

    NameTypeDefaultDescription
    input1BOOLEANfalse
    input2BOOLEANfalse

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN