Switch Float
Flip between two values on a condition
- FLOAT
Switch Float is the float-specialist version of the pack's Switch Any. Give it a boolean condition and two floats - if_true and if_false - and it hands back one of them depending on the condition. Nothing gets converted, nothing gets truncated; you just pick a value at runtime. It's the node you reach for when a single checkbox or comparison should decide between two numerical settings.
Why you'd reach for it
The classic use is swapping a float parameter between two presets without rebuilding the graph. A checkbox decides whether you're in "fast preview" or "final render" mode, and that one boolean routes between two denoise strengths, two CFG values, or two upscale factors. Or a Compare node upstream decides "image is small enough" and the switch picks between two scale amounts. One boolean, two values, one output - that's the whole pattern, and it's everywhere once you look for it.
It also composes with the pack's logic and compare nodes: Compare Float or Number → Bool produces the condition, Switch Float does the routing. Compared to the untyped Switch Any, the payoff here is strict FLOAT sockets - ComfyUI will refuse to connect an INT (or auto-convert in a way you didn't ask for), which catches a whole class of wiring mistakes before they become silent bugs.
How it works
A single Python conditional: if_true if condition else if_false. No clamping, no defaults being secretly applied - when the condition is false, you get exactly if_false; when true, exactly if_true. The author's description is "Returns if_true when condition is True, otherwise returns if_false. Works with floats." It lives in SimpleLogics/Switch, and the pack ships identical siblings for ints and strings (and a wildcard Switch Any for everything else).
The inputs that matter
Three required inputs:
condition- theBOOLEANthat picks the branch (defaults toFalse)if_true- theFLOATreturned when condition is true (default0)if_false- theFLOATreturned when condition is false (default0)
One FLOAT output, ready for any float socket.
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 main gotcha is expecting the switch to do something with the values - it doesn't, it just selects. If you're feeding it a computed value and wondering why the output isn't clamped or rounded, that's a different node's job. The other common confusion: if both your values are integers, an INT input will try to auto-convert into the float socket, and the result can be subtly off - use Switch Int for integer work instead. Otherwise this is about as failure-proof as nodes get. (And the usual pack note: installing it also registers an undocumented GeoCalib camera node - ignore that one.)
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| condition | BOOLEAN | false | — |
| if_true | FLOAT | 0.00 | — |
| if_false | FLOAT | 0.00 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |