Int → Bool
Making ComfyUI read numbers as switches
- BOOLEAN
Sometimes a node hands you an integer that isn't really a number - it's a flag wearing a number costume. A model loader reports variant "1" or "0". A counter tells you whether something has happened at all. And the boolean logic nodes you want to feed it with will simply refuse an INT wire. SL_IntToBool is the un-dresser: it looks at an integer and tells you whether it's "true" or "false" in the everyday sense.
The rule, straight from the source: value != 0. Zero becomes False, and any other value becomes True - including negative numbers, which trips people up. If you were expecting only positive values to count as true, adjust your expectations: in this pack, -3 is just as true as 3.
The mechanism is Python's truthiness for integers, exposed as a node. It's the reverse of SL_BoolToInt (which turns True/False into 1/0), and it's the correct companion when you have an integer flag and want to drive logic gates, switches, or conditionals with it.
Inputs and outputs:
value(INT) - the integer, default 0- Output:
BOOLEAN-Falseif 0,Trueotherwise
Installing it
Part of ComfyUI-SimpleLogics. Manager → search "SimpleLogics" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/danipisca07/ComfyUI-SimpleLogics
Restart, Add Node → search "Int → Bool" (menu group SimpleLogics/Convert). Zero dependencies, no models.
Where it shows up
- Feeding logic nodes: an integer flag from another pack becomes a proper boolean for
SL_AND,SL_OR, orSL_NOT. - Driving switches: feed
SL_SwitchIntorSL_SwitchAnya condition derived from a number. - Normalizing "did it run" checks: convert a count or index into a clean yes/no for a conditional branch.
Gotchas
- Only zero is false. If the upstream value is a count and you want "false when the count is 0," this works. If it's a status code where
0means "good" and1means "bad," this node inverts your intent - read the semantics of your source first. - Negative numbers are true.
-1→True. If your source can be negative and that matters, filter it with a compare node first. - It's a conversion, not a threshold. "Is this number bigger than 5" is
SL_CompareInt's job, not this node's. Use each for what it does.
It's a two-second conversion, but it's the kind of glue that unblocks an entire conditional branch. When a boolean port is glaring at an integer wire, this is the handshake that makes them agree.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |