IntToBool
The cleanest way to turn a number into a real boolean
- BOOLEAN
Small node, one job: give it an integer, get back a boolean. Zero is false, anything else is true - the same convention every C-descended language uses for truthiness. IntToBool is a conversion utility from ComfyMath, evanspearman's small pack of boolean/int/float/vector math nodes for ComfyUI, and it's the one you reach for when something in your graph produces a number (a counter, a modulo result, a flag some other node happens to output as an INT) and you actually need a proper boolean to drive a switch.
Why this one specifically
ComfyUI's core doesn't give you a native "int to bool" cast, and a lot of custom nodes that do gate/switch logic are picky about exactly which boolean type they'll accept. This node matters more than it looks like it should because of which boolean type it outputs - more on that below.
How it works
There's no configuration beyond the input itself. Feed a (an integer, default 0) in, and the node checks it against zero: 0 comes out false, any nonzero value - positive or negative - comes out true. That's it. No operator dropdown, no options.
A common pattern this enables: take a modulo result from earlier math (say, frame_index % 2) and feed it straight into IntToBool to get an every-other-frame toggle, or take a counter that increments each loop iteration and use IntToBool to flag "we're past zero, start doing the real work."
Inputs and outputs
a(INT, default 0) - the integer being tested.- Output:
BOOLEAN- and this is the detail worth remembering. This is ComfyUI's own native boolean type, not the customBOOLtype that most of ComfyMath's other condition nodes (IntBinaryCondition, IntUnaryCondition, NumberBinaryCondition, and friends) output. If you need a boolean that plugs directly into a switch or "If" node from some other pack without a conversion step, this is the ComfyMath node built for that, alongsideCM_FloatUnaryCondition.
How to install it
Via ComfyUI Manager: search ComfyMath, install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/evanspearman/ComfyMath.git
then restart ComfyUI. There's nothing to configure post-install - no requirements.txt, no weights, no API keys. It's a handful of Python files doing arithmetic.
Common issues & troubleshooting
A workflow won't load, complaining about a missing node. That's ComfyUI telling you it doesn't have ComfyMath installed - grab it via Manager as above and reload.
You need the opposite conversion (a bool that behaves like an int). This pack ships the int-to-bool direction; if you need to go the other way, you're generally better off using a comparison node (like CM_IntBinaryCondition, Eq against 0) rather than assuming there's a matching BoolToInt sitting in this pack - check the node list in Manager if you're not sure what's available.
The pack looks abandoned. It largely is, in the sense that active development stopped a while back - a 2024 community thread flagged the author had moved on. For a node this simple, that's a non-issue: there's no dependency to break and no reason for a ComfyUI update to touch it. Treat it as finished, not neglected.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |