Number → Bool
Turn a number into a switch condition
- BOOLEAN
Number → Bool is the type adapter that answers "is this number nonzero?" It takes a NUMBER, and the rule is dead simple: 0 becomes False, anything else - negative, fractional, huge - becomes True. If you've ever had a node hand you a numeric result and wished you could feed it into a switch's boolean condition, this is the missing link.
Why you'd reach for it
ComfyUI's condition system runs on booleans, but a lot of real-world signals come out as numbers. A face detector might give you a count. A comparison or math chain might give you a difference. An OCR or metadata node might hand you a score. None of those plug into a condition socket directly - you need a boolean, and this node is the conversion.
The nonzero rule is genuinely useful: it lets you treat "did this produce anything" as a boolean. Count of detected faces 3 → True; count 0 → False. A difference of 0.0 means "nothing changed" → False; any drift at all → True. Combined with the pack's switch nodes, this is how you build "if there's any result here, route differently" logic in one clean line.
How it works
The implementation is Python's value != 0 - the author's description is explicit: "Converts a NUMBER to a boolean: 0 → False, any other value → True." It's the NUMBER-input sibling of the pack's Int → Bool, which does the same trick for INT inputs. Note this is a strict test: only exact zero is false, so 0.0001 still reads as True. If you need a threshold ("only when the value passes 5"), you'll want a Compare node instead, then convert that boolean - or just feed the number into a compare and skip this entirely.
The inputs that matter
One required input:
value- theNUMBERyou want to test (defaults to0)
One BOOLEAN output, ready for any switch's condition socket or for chaining into the pack's logic gates.
Installing it
Comes with danipisca07/ComfyUI-SimpleLogics, the dependency-free pure-Python pack - no requirements.txt, no models. Install from ComfyUI Manager (search "SimpleLogics") or:
cd ComfyUI/custom_nodes
git clone https://github.com/danipisca07/ComfyUI-SimpleLogics
Restart ComfyUI and you're done.
Common issues
The one thing that bites people is expecting "truthiness" rules from other languages - like a negative number being "false" - when this node treats only zero as false. Negative values are True here. And if your boolean seems wrong, double-check what type is actually coming in: if you're feeding an INT, the pack's Int → Bool is the matching conversion; NUMBER and INT sockets behave differently on the wire. Otherwise this is a trivial, reliable cast. (Pack quirk, same as always: installing SimpleLogics also registers an undocumented GeoCalib camera node - ignore it.)
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | NUMBER | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |