Nodes/ComfyUI_DualConditionBoolean/SZ Dual Condition Boolean
ComfyUI Node

SZ Dual Condition Boolean

Test one number against two thresholds and get a clean True/False out of it

By kuikuite·Created 2 months ago·Updated 2 months ago· 0
SZ Dual Condition Boolean
  • a
  • b1
  • b2
  • output
  • string
a_value
b1_value0
operator1
b2_value1.6
operator2
condition
match_outputfalse

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 wire a and leave this blank)
  • b1_value, b2_value - your two thresholds, defaulting to 0 and 1.6
  • operator1, operator2 - ==, !=, >, <, >=, <= each
  • condition - or or and. This is how you build a range check: >= against one bound and <= against the other
  • match_output - the "in range" value, default False

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 a but changed a_value and 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" into b1, the node uses it raw (the regex only runs on the text fields). Keep a/b1/b2 numeric and you're safe.
  • Output feels backwards. You forgot match_output is 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.

CategorySZ Nodes/Logic

Inputs (10)

NameTypeDefaultDescription
a_valueSTRING
b1_valueSTRING0
operator1COMBO6 options: ==, !=, >, <, >=, <=
b2_valueSTRING1.6
operator2COMBO6 options: ==, !=, >, <, >=, <=
conditionCOMBO2 options: or, and
match_outputBOOLEANfalse
aopt*
b1opt*
b2opt*

Outputs (2)

NameTypeDescription
outputBOOLEAN
stringSTRING