Not
The one-word inverter that fixes half your logic bugs
- negation
Not is the smallest useful node in marco-zanella's ComfyUI-BooleanExpression pack: one boolean in, its opposite out. And despite being one line of Python, it quietly fixes a disproportionate number of "my branch goes the wrong way" bugs. Half the time the fix for a backwards conditional isn't rewiring anything - it's sticking a Not on the condition and moving on.
How it works
One required input:
value- the boolean to negate (defaulttrue)
Output is negation, a BOOLEAN: not value. That's the entire mechanism. The author's tooltip says it best: "Boolean value to negate." No flags, no modes, no surprises.
The patterns:
- Flip a comparison. Your condition is "steps less than 30" but the special case should fire at 30 or more? Not turns
<into the effective>=without hunting for a different node. - Invert a toggle. A checkbox labeled "enable upscale" feeds the whole graph; a Not lets you derive "skip upscale" from the same toggle.
- Sanity-check compound logic. When an And/Or expression is behaving oppositely to your mental model, an explicit Not in the right spot is clearer than rewriting the whole gate.
Installing it
No models, no dependencies, pure Python - the pack's requirements.txt is empty, so "installing" is just getting the folder 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
- It only negates booleans. The input is BOOLEAN-typed, and Python's
noton a non-boolean does truthiness - but ComfyUI may not coerce the way you hope. Feed it a real boolean from a comparison node or toggle, not an INT you're treating as a flag. - Not does not mean "skip." It flips a value; it doesn't bypass or mute a branch. If you want a node chain to not run at all, mute/bypass it in the UI. This is the same "logic isn't control flow" lesson that trips people up with Conditional Branch.
- Both branches downstream still compute when you chain Not into a branch - the unselected input chain runs anyway. Irrelevant for booleans, but worth remembering for the general pattern.
Not is boring, which is exactly why it's good. You won't build a graph around it, but the day your toggle needs to mean the opposite, it's the difference between a clean one-node fix and a maze of rewired branches.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | BOOLEAN | true | Boolean value to negate. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| negation | BOOLEAN | — |