and (generic)
An AND gate that doesn't care what you feed it
- item_0
- BOOLEAN
Most boolean nodes in ComfyUI demand actual BOOLEAN wires and pout if you give them anything else. This one shrugs, takes whatever you have, and applies Python's own truthiness rules to it. That's the whole pitch of "and (generic)" from the Basic data handling pack: an AND gate with an attitude - and honestly, with some utility.
What it does
It returns True only if every connected input is "truthy," and False the moment any one of them isn't. The twist is what "truthy" means. The node evaluates values the way Python does: the number 0, an empty string "", an empty list, and False are all falsy. The string "0"? Truthy - it's a non-empty string. The number 5? Truthy. This is the same rule that makes if "yes" work in Python, and it means you can wire this node's inputs straight onto all sorts of non-boolean outputs without casting first.
The invert trick
There's a required invert checkbox (default off). Tick it and the result flips, turning the whole thing into an NAND gate. It's a one-click way to get "not all of these are true" without bolting a separate not node onto the output.
Inputs and outputs
invert- BOOLEAN, default false. Flip to get NAND behavior.item_0- a wildcard*input, default"True", and the node takes a dynamic number of these. Add moreitem_Ninputs from the node's UI (the pack's dynamic-input support) and wire in as many values as you need. Note the default: leaveitem_0unwired and it counts asTrue, which is exactly what you want when you're AND-ing just to gate one branch.- Output - a single
BOOLEAN, the AND (or NAND) of everything.
Install
Comes with the Basic data handling pack. Manager → search "Basic data handling" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart ComfyUI. No dependencies, no model downloads - the pack is plain Python builtins.
Where people get burned
They forget that an empty string or 0 is falsy, so a workflow that "should" return True comes back False because one input arrived as an empty text field. If that bites you, check what's actually on each wire before assuming the node is broken. And remember invert flips the whole result - the one time you tick it "to see what it does" and leave it ticked is the classic self-inflicted bug.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| invert | BOOLEAN | false | — |
| item_0opt | * | True | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |