SZ Dual Condition Boolean
Test one number against two thresholds and get a clean True/False out of it
- a
- b1
- b2
- output
- string
You know that moment when half your workflow should only run under certain conditions - but ComfyUI doesn't do if? This is the node that fakes one. SZ Dual Condition Boolean compares one value against two numbers, combines the two results with and or or, and hands you a clean boolean plus a string version of it. That boolean then feeds a switch, a mask, or any other node that gates a branch. It's plumbing, not glamour, but once you've wired a gate with it you'll keep reaching for it.
The "SZ" prefix tells you its lineage: this node is lifted out of the big LayerStyle suite and repackaged on its own so it installs standalone without colliding with a LayerStyle install you might already have. If you've never touched LayerStyle, no problem - you don't need it. The pack ships exactly one node and nothing else. No models, no dependencies, no requirements.txt. It's pure Python that uses only the standard library, which is why it's essentially unbreakable.
How it works
Under the hood it's embarrassingly simple, and that's the appeal. It takes your value a, compares it to b1 with operator1, compares it to b2 with operator2, then combines the two booleans with your chosen condition. The twist that trips people up is match_output:
- If the conditions match, output =
match_output. - If they don't match, output = the opposite.
So match_output is really "what should the output be when I'm in the target range." The README's example sets it up so the node returns False exactly when a == 0 or a >= 1.6 - in other words, it passes True for the sweet spot in between. Read it as "this branch is allowed when the value is in range," and you'll never invert yourself into confusion again.
One more mechanism detail worth knowing: the value fields are text inputs, so the node regex-scrapes the first number it finds in each string. Type 1.6, fine. Type seed 42, it grabs 42. Type nothing at all, you get 0. The optional wire inputs a, b1, and b2 are typed as * (any), and when connected they always win over the text boxes - the README states this outright, and people still get bitten by it.
The inputs that matter
You'll actually set maybe five of these:
a_value- the number you're testing (or wireaand leave this blank)b1_value,b2_value- your two thresholds, defaulting to0and1.6operator1,operator2-==,!=,>,<,>=,<=eachcondition-ororand. This is how you build a range check:>=against one bound and<=against the othermatch_output- the "in range" value, defaultFalse
It outputs output (BOOLEAN) and string (the same thing as text, handy for feeding text-display nodes or string-expecting inputs). Wire output into anything that accepts a boolean - a switch's selector, a conditional branch, a mask's enable toggle.
Install
ComfyUI Manager works: search ComfyUI_DualConditionBoolean and install. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/kuikuite/ComfyUI_DualConditionBoolean
Restart ComfyUI. That's the whole install - there's nothing to download, no weights, no Python deps.
Common issues
- You wired
abut changeda_valueand nothing happens. Correct - a connected input overrides the text field. Unwire it or edit the text. - Comparing strings instead of numbers. The optional inputs accept anything, so if you wire a text value like
"abc"intob1, the node uses it raw (the regex only runs on the text fields). Keepa/b1/b2numeric and you're safe. - Output feels backwards. You forgot
match_outputis the "condition is true" value. Flip it and the logic inverts.
It's not a flashy node and nobody's writing Reddit posts about it - but when you need "run this branch only while CFG is between 5 and 8," it's exactly the tool.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| a_value | STRING | — | |
| b1_value | STRING | 0 | — |
| operator1 | COMBO | 6 options: ==, !=, >, <, >=, <= | |
| b2_value | STRING | 1.6 | — |
| operator2 | COMBO | 6 options: ==, !=, >, <, >=, <= | |
| condition | COMBO | 2 options: or, and | |
| match_output | BOOLEAN | false | — |
| aopt | * | — | |
| b1opt | * | — | |
| b2opt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| output | BOOLEAN | — |
| string | STRING | — |