ComfyUI Node

And

Both conditions? Then And is your node

By marco-zanella·Created about a year ago·Updated about a year ago· 0
And
    • and
    firsttrue
    secondtrue

    ComfyUI gives you boolean values - toggles, seed nodes, the True/False constants - but it mostly leaves the combining to you. That's where And comes in. It takes two booleans and returns true only when both are true. That's the entire job description, and it's exactly what you need when a workflow should only do the fancy thing if two conditions hold at once.

    It's part of marco-zanella's ComfyUI-BooleanExpression pack, a dependency-free logic-node collection that fills the "where are my boolean operators" gap that core ComfyUI never bothered with. And is the most intuitively useful of the lot, because and is the condition you reach for when you're being careful.

    How it works

    Two required inputs, both BOOLEAN and both defaulting to true:

    • first - the first boolean value
    • second - the second boolean value

    One output, named and, of type BOOLEAN: it's first and second, full stop. No type coercion tricks, no hidden logic - the source is literally a one-liner. Feed it the outputs of two comparison nodes and you get a compound condition.

    The pattern that makes it shine: two Greater than or Equal to checks feed an And, and the combined result drives a Conditional Branch. Say you only want to run the high-detail pass when the batch is large and the resolution is high. Each check on its own isn't enough; both together is the actual rule. That's And's whole reason to exist, and it keeps your graph readable instead of nesting branches three deep.

    Installing it

    No models, no dependencies, nothing to download but the code - the pack's requirements.txt is empty and it's pure Python. Install through ComfyUI Manager by searching ComfyUI-BooleanExpression, or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git
    

    Restart ComfyUI and it appears under Boolean Expressions, right next to the other gates.

    Gotchas

    • Feed it real booleans. Wire a BOOLEAN output (a comparison node, a toggle) into both inputs. Some packs accept any type and treat truthiness as a bonus; this one wants actual booleans, and mixing in unrelated types is how you get "why is this always true" debugging sessions.
    • Both inputs default to true. New nodes start out returning true regardless of what's upstream, which confuses people for a hot second when they first drag one in. It's a sensible default - just don't read it as "the node is broken."
    • If you need more than two inputs, chain And nodes together or use Binary Expression from the same pack, which puts all the boolean gates behind one dropdown.

    One light gripe: the output is literally named and, so when you wire it somewhere the socket label reads "and" and nothing else. Cute, but on a busy graph you'll occasionally squint at it. Not worth skipping the node over - for combining conditions, it's the one I'd reach for.

    CategoryBoolean Expressions

    Inputs (2)

    NameTypeDefaultDescription
    firstBOOLEANtrueThe first boolean value.
    secondBOOLEANtrueThe second boolean value.

    Outputs (1)

    NameTypeDescription
    andBOOLEAN