DD Either
\"whichever input actually has a value wins\"
- ANY
- if_any
- output
Despite the name, DD Either isn't doing any boolean math. There's no true or false anywhere in its inputs. What it does is solve a quieter, more annoying problem: "one of these inputs might be populated, and I just want whichever one actually shows up."
It's a pass-through with a priority. The node takes a required ANY input and an optional if_any input, and it outputs if_any if that optional input has a value in it - otherwise it passes ANY straight through. The name is the summary: either one is fine, but if you've bothered to fill if_any, that's the one you get.
Why you'd reach for it
ComfyUI has no way to express "this input is optional" in the graph itself. So people build the same pattern over and over: a branch that might run - an optional upscaler, an optional LoRA, an optional detailer - and they want the workflow to work whether that branch produced something or not. DD Either is that pattern in a box.
Say you have an optional face-enhancement pass. If it ran, you want its output. If it didn't (bypassed, or a node upstream failed to produce), you want the plain image. Wire the plain image into ANY, the enhancement branch's output into if_any, and the node picks for you. It's also handy when you're assembling a workflow template you'll share - the person downloading it can wire in their optional step without editing the graph's logic.
The mechanism
Under the hood it checks whether if_any is actually populated - the code calls if_any.any() and falls back to a plain truthiness check if that isn't available - and outputs whichever side had something. Both inputs are MatchType, so they adopt the type of whatever you connect, and the output is named output. Keep the two sides the same type; you can't meaningfully choose between an image and a string.
A naming trap worth flagging
The easy misread is "first non-empty input wins, independently." It's not. It's a strict priority: if_any always beats ANY when it has a value. If both are wired, if_any wins every time, and if that surprises you it's probably because you expected "either," not "prefer the optional one." Read it as "if_any is set, use it; else pass ANY through" and you'll never be confused.
Installing
Same pack as the rest of DD-LogicNodes: ComfyUI Manager, search DD-LogicNodes, install, restart. Or clone https://github.com/dumbdemon/DD_LogicNodes into ComfyUI/custom_nodes. Zero dependencies, zero models, and - the one real requirement - a reasonably current ComfyUI, since the pack uses the newer extension API.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| ANY | COMFY_MATCHTYPE_V3 | — | |
| if_anyopt | COMFY_MATCHTYPE_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | COMFY_MATCHTYPE_V3 | — |