ComfyUI Node

Or

The 'any of these' gate

By marco-zanella·Created about a year ago·Updated about a year ago· 0
Or
    • or
    firsttrue
    secondtrue

    Or is the "any of these is good enough" gate, and it's the more forgiving half of the boolean pair that And is the strict half of. Two booleans in, true out when at least one of them is true. Where And demands everything, Or accepts anything. In workflow terms: "run the special handling if the resolution is high or the batch is big" - not both, either. That looseness is exactly what you want for fallbacks and escapes.

    It's part of marco-zanella's ComfyUI-BooleanExpression pack, a dependency-free logic collection. Or shares And's exact anatomy - same inputs, same output shape - just with a different truth table.

    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 or, of type BOOLEAN: first or second. The source is a one-liner - Python's or, no hidden coercion. Feed it the outputs of two comparison nodes and a single wire carries the "either of these is true" verdict.

    The pattern that makes it earn its keep: fallbacks. "If the checkpoint name is X or Y, use the alternate CFG." "If steps are under 20 or resolution is low, skip the detail pass." Where And narrows a workflow, Or widens an escape hatch - and it composes: two Or nodes can fold three conditions into one line of logic.

    Installing it

    No models, no dependencies, pure Python - the pack's requirements.txt is empty, so install is just getting the code in place. ComfyUI Manager, search ComfyUI-BooleanExpression, or:

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

    Restart ComfyUI, and it's under Boolean Expressions.

    Gotchas

    • Both inputs default to true. A fresh Or node returns true before you've wired anything - which is, honestly, the exact opposite of the surprise And gives you. Just don't read an unconnected Or as "working as intended."
    • Feed it real booleans. Wire genuine BOOLEAN outputs (comparisons, toggles, the pack's True/False constants). Mixing in unrelated types is how you get logic that "sort of" works.
    • Or isn't a merge. It doesn't combine two values or pick a better one; it just asks "is either true?" If you're trying to choose between two latents or prompts, that's Conditional Branch's job, not Or's.
    • Both branches downstream still compute. Chain Or into a Conditional Branch and the unselected path upstream runs anyway - trivial cost for booleans.

    The output is named or, same quirk as And's and, which is mildly confusing on a busy canvas but never worth skipping the node over. For "any of these triggers the behavior," it's the right tool - grab it before you reach for a custom script.

    CategoryBoolean Expressions

    Inputs (2)

    NameTypeDefaultDescription
    firstBOOLEANtrueThe first boolean value.
    secondBOOLEANtrueThe second boolean value.

    Outputs (1)

    NameTypeDescription
    orBOOLEAN