ComfyUI Node

or (generic)

OR with Python's truthiness, not just booleans

By StableLlama·Created about a year ago·Updated 4 days ago· 48
or (generic)
  • item_0
  • BOOLEAN
invertfalse

The generic version of the pack's OR node is the "don't make me cast everything first" answer to boolean logic in ComfyUI. It takes any number of values of any type, evaluates each one under Python's rules, and returns True if any of them is truthy. Pair it with its cousin "and (generic)" and you can do real conditional logic in a workflow without a forest of comparison nodes.

What it does

For each input it asks the same question Python asks for any value: is this truthy? Non-zero numbers, non-empty strings, non-empty lists, and True are all truthy; 0, "", [], and False are falsy. Then it returns True if any input answered truthy, and False if all of them were falsy.

Where that earns its keep: you've got three possible sources for a value - say a loaded image path from one branch, a default path from another, and a wildcard string from a third - and you want to know "is at least one of these actually populated?" Wire all three in, read the boolean, and skip the comparison nodes entirely.

The invert checkbox

There's a required invert BOOLEAN input (default false). Tick it and the output flips, giving you a NOR gate: True only when every input is falsy. Handy for "none of these conditions are set" checks.

Inputs and outputs

  • invert - BOOLEAN, default false, flips the result to NOR.
  • item_0 - wildcard *, and dynamic: add more item_N inputs from the node to OR together as many values as you like. Note that unlike the AND variant, item_0 here has no default, so leave it empty and the node reads it as falsy.
  • Output - one BOOLEAN, the OR (or NOR) of all inputs.

Install

From the Basic data handling pack. Easiest via ComfyUI Manager: search "Basic data handling", install, restart. Manual install is the standard clone:

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

then restart ComfyUI. The pack is dependency-free - nothing to pip install, no models to download.

A trap to dodge

"0 out of 3 values set" reads as False, which is what you'd expect. But "an empty string on one wire" also counts as not-set, so a workflow that produced a blank line somewhere quietly reports False. When the output isn't what you expect, check whether any input is an empty value rather than a missing one - they're not the same thing to this node.

CategoryBasic/BOOLEAN

Inputs (2)

NameTypeDefaultDescription
invertBOOLEANfalse
item_0opt*

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN