đź’€Prepack Logic Int
Branch your workflow on numbers — with a built-in 'any value' escape hatch
- true
- false
- any
- output
ComfyUI workflows grow branches fast - "if the step count is low, use this sampler; otherwise use that one" - and vanilla ComfyUI makes conditional routing awkward. The đź’€Prepack Logic Int is the branch condition: you set a target integer, define up to two comparisons against it, and the node hands back one of the inputs you give it based on whether the comparison passes. It's an if/then for numbers, with a string-matching override bolted on that I'll get to in a second.
How it works
The core comparison is simple. target_int is the reference value. comparison_a and comparison_b are two dropdowns - each with the six options A = target, A ≠target, A < target, A > target, A <= target, A >= target (and the same set for B). You feed int_a and int_b as the values to compare. If both comparisons hold, the node outputs whatever is on the true input; otherwise it outputs the false input.
So a "check if my width is big enough" gate looks like: target 1024, A >= target, int_a wired to your width, true → the upscale path, false → the straight-to-output path.
The interesting part is the any input and its two string fields, any_target_name and any_name. These add a string-match priority on top of the integer logic: if any_target_name is a substring of any_name (case-insensitive), the node returns the any input immediately, before the integer comparisons even run. That's a text-passthrough escape hatch - a way to force a particular branch by name ("if this checkpoint is 'realvisxl', route here") without needing a second node.
The output is a single output typed *, so it passes through whatever you put on true/false/any - a model, a conditioning, a string, anything. The node also logs its decisions to the console with a [Prepack] prefix, which is genuinely handy when a branch takes a path you didn't expect; the log tells you which case matched.
Where people get burned
The true and false inputs are both optional. If you wire only true and the comparison fails, you get None out - which then flows into whatever's downstream and produces a "value is None" style error. Wire both branches, or accept that the unconnected side is deliberately a dead end.
The string-match override trips people up more than anything. If you populate any, any_target_name, and any_name, a substring match always wins over the integer logic - it's not a fallback, it's a priority. If you're getting the any branch when you expected the int comparison to decide, that's why.
Installing it
It's part of the Prepack pack:
cd ComfyUI/custom_nodes
git clone https://github.com/S4MUEL-404/ComfyUI-Prepack.git
pip install -r ComfyUI-Prepack/requirements.txt
Or search "Prepack" in ComfyUI Manager. Dependencies are minimal (PyTorch, NumPy, Pillow). Restart, find it under đź’€Prepack. No models, no config.
If a branch seems to fire at the wrong time, read the console - the node prints which comparison case it took, and that tells you instantly whether the issue is the target value, a missing comparison, or the string-match override stealing the decision.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| target_int | INT | 0 | — |
| comparison_a | COMBO | A = target | 6 options: A = target, A ≠target, A < target, A > target, A <= target, A >= target |
| comparison_b | COMBO | B = target | 6 options: B = target, B ≠target, B < target, B > target, B <= target, B >= target |
| trueopt | * | — | |
| falseopt | * | — | |
| anyopt | * | — | |
| int_aopt | INT | 0 | — |
| int_bopt | INT | 0 | — |
| any_target_nameopt | STRING | — | |
| any_nameopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |