To Boolean
Turn anything into a true or false
- value
- boolean
- int
Switches are everywhere in a real workflow, but they all key on the same thing: a boolean. And the world hands you counts, sizes and sentences, not booleans. To Boolean is the adapter that reads whatever you've got and answers the question the switch is actually asking - "is this thing true or not?"
What it does
Feed it a value - and the input socket takes STRING, INT, FLOAT, NUMBER or BOOLEAN, so anything lands in it - and out comes a proper boolean (true/false) plus an int version (1 or 0) for arithmetic that counts branches. How the value reads:
- A number is true when it isn't 0.
- Text is read as a word first.
true,yes,onand1are true;false,no,off,0and empty are false.
That last set is worth noticing: it handles both the string "1" and the word on, which means a text widget used as a checkbox by another pack converts correctly instead of needing three converter nodes.
Two more knobs cover the awkward cases. unreadable decides what text that is neither (like maybe) does - false treats it as false, true treats any unrecognised word as true. And invert flips the answer, saving you a Logic NOT node after it. Both are the kind of convenience you ignore until you need it once, and then you're glad it's there.
Why you'd reach for it
The pack's own logic is boolean-typed end to end - "Every switch in this pack keys on a boolean, and only one other node answers one from a number" - so this is usually the bridge between a measurement and a branch. Concrete cases:
- A Text List Length count drops to zero → you want a switch to route around the empty list. To Boolean turns "is the count non-zero?" into a wire.
- A comparison, a size, or a per-image flag from elsewhere in the graph needs to drive an A/B switch.
- You're reading config from text and a "true/false" string needs to become an actual condition.
Wire the boolean output into any switch's boolean input and the branch follows the value. The int output is for when you're counting true results or doing boolean-as-arithmetic - summing how many of several conditions held, say.
What it's not
To Boolean is a one-value reader, not a comparison operator. If you need "is X greater than Y?" that's a Compare node's job, feeding its boolean into a switch. This node's whole trick is type-shifting an existing value into boolean form - and refusing to guess on words it doesn't know (unless you tell it to). Keep that straight and it's a perfectly predictable little gear.
Installing it
Part of WAS Node Suite v3 (WASasquatch's was-node-suite-comfyui, MIT). Search "WAS Node Suite v3" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
Restart ComfyUI after installing. Requires ComfyUI 0.14.0+ and Python 3.10+; no extra packages needed.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| value | STRING,INT,FLOAT,NUMBER,BOOLEAN | What to read. A number is true when it is not 0. Text is read as a word first, so `true`, `yes`, `on` and `1` are true and `false`, `no`, `off`, `0` and empty are false. | |
| unreadable | BOOLEAN | false | Answer for text that is neither, such as `maybe`. false treats it as false; true treats any unrecognised word as true. |
| invert | BOOLEAN | false | Flip the answer, saving a Logic NOT after it. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| boolean | BOOLEAN | The value as true or false. Wire it to any switch's boolean. |
| int | INT | The same answer as 1 or 0, for arithmetic that counts branches. |