If else with two float values
The one-node ternary you keep reaching for
- value
Stock ComfyUI has a real hole: there's no clean way to say "use value A when this condition is true, otherwise value B" for a number. You end up building two parallel branches and a switch node, or worse, retyping values every time you change a setting. IfElseFloat (pack comfyui_gvf) collapses that whole rig into a single node: wire in a boolean, give it two floats, and it hands you back one of them. It's the "if else with two float values" node, and it's exactly as straightforward as the name suggests.
The mechanism is one line of Python under the hood: if_true if boolean else if_false. No magic, no model, no dependencies. It takes three inputs:
- if_true - a FLOAT (default 1.0), returned when the condition is true.
- if_false - a FLOAT (default 0.0), returned when it's false.
- boolean - a BOOLEAN (default false). This is where the condition comes from; the node doesn't compare anything itself.
The single output is value, a FLOAT, ready to plug into any float input on the graph - CFG scale, denoise strength, sampler steps, a lerp node, whatever.
The "boolean" input is the part beginners stumble on. This node has no comparison built in - it won't check "is denoise > 0.5" on its own. You supply the boolean from elsewhere: a comparison node (plenty of packs have them, and ComfyUI's core ecosystem is full of "compare" helpers), a control input, or just a manual toggle. The pattern that makes this genuinely useful: toggle CFG between 4 and 7 with one switch, flip denoise between 0.4 and 0.75 for a "quick pass / full pass" workflow, or switch between two sampler step counts without editing numbers mid-flow. Once you've used it for a week, you start seeing every hard-coded value as a potential toggle point.
One note for the pedants: it's strict about types. IfElseFloat returns a FLOAT and takes floats; if your workflow is feeding it ints and later complains about a type mismatch, that's the sibling IfElseInt you actually want. Also know the pack's StringContains node - which would have given you string comparisons to drive the boolean - is defined in the source but commented out and not shipped, so don't go looking for it.
Installation is the same zero-friction routine as every node in this pack. ComfyUI Manager → search "comfyui_gvf", or:
cd ComfyUI/custom_nodes
git clone https://github.com/gvfarns/comfyui_gvf
Restart, and it shows up under the "gvf" category. No requirements, no model files, nothing to break. It's a boring little node, but boring is exactly what you want when it's holding your workflow's control logic together.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| if_true | FLOAT | 1.00 | — |
| if_false | FLOAT | 0.00 | — |
| boolean | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | FLOAT | — |