Logical AND
Short-circuiting for boolean wiring
- BOOLEAN
Logical AND takes two booleans and returns True only if both are True. If that's all it did, it would be the most forgettable node in the pack. The interesting bit is in its own description: "If input1 is False, input2 is not evaluated." That's short-circuiting - and in a graph where nodes cost GPU time, it's a real optimization, not a party trick.
The inputs
input1- first BOOLEAN.input2- second BOOLEAN, marked lazy.- output - BOOLEAN, the logical AND of the two.
Because input2 is lazy, the executor only computes it when the answer could actually change. If input1 is already False, the AND is guaranteed False no matter what input2 is, so ComfyUI skips computing input2 entirely. In ComfyUI, "skip computing" can mean skipping a whole expensive branch of your graph.
Why that matters in practice
Think of a workflow with a "do advanced upscaling" toggle that only makes sense when another flag is set. You want advanced_enabled AND model_loaded. If advanced_enabled is False, you don't need to know whether the model loaded - and more importantly, you don't want the graph to go off and load it just to answer a question whose answer is already settled. That's the pattern: stack conditions so that cheap checks come first (input1) and expensive checks come second (input2). Order the inputs with cost in mind - the node can only skip input2, so put the pricey test last.
How it works
The node's check_lazy_status hook reports which inputs are actually needed: if input1 is True, it requests input2; if input1 is False, it requests nothing and returns False directly. Same trick as the pack's If Condition - lazy evaluation is the pack's house style.
Where people get burned
- Putting the expensive check first. The node short-circuits on
input2, notinput1. Cheap check oninput1, expensive check oninput2- otherwise you've paid for the expensive one anyway. - Side effects in
input2. If something on the second input has side effects (a Sow, a log), a Falseinput1means it never runs. That's the deal - and why the pack keeps side effects in separate nodes. - It's not bitwise. This returns a Python boolean, so chaining three conditions means stacking two AND nodes (or using it with the pack's OR).
Installing it
Part of Duanyll/comfyui_functional (logic category). ComfyUI Manager: search "Duanyll/comfyui_functional", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/comfyui_functional
# restart ComfyUI
No models, no pip deps. Portable and dependency-free - you can use this node in any workflow, even ones that never touch the rest of the pack.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | BOOLEAN | — | |
| input2 | BOOLEAN | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |