_ForLoopCounter | akatz-loops
The Invisible Counter That Runs Every For Loop in This Pack
- decremented
- should_continue
You're not supposed to use this node. That's not a diss - the underscore in _ForLoopCounter is the pack telling you it's an internal helper, and the author deliberately left it out of the display-name mappings so it doesn't clutter your node menu. It exists because the pack's ForLoopClose node needs a tiny piece of bookkeeping: count down the remaining iterations and report whether to keep looping. This node is that bookkeeping.
Here's the whole job. It takes one input, current_value (an INT), and outputs two things:
- decremented (INT) -
current_value - 1. - should_continue (BOOLEAN) -
decremented > 0, i.e. "is there another iteration to run?"
That's it. Subtract one, check if the result is still positive. Every ForLoopOpen/ForLoopClose pair in the pack wires this node up automatically behind the scenes: the close node instantiates a _ForLoopCounter, feeds it the remaining count, and uses its should_continue output as the while-loop's condition. You see a ForLoopClose and it feels like magic; under the hood it's a while-loop being driven by this three-line counter.
Can you ignore it?
Yes, in every practical sense. If you build loops with ForLoopOpen/ForLoopClose, the counter is placed for you and you never touch it. If you're hand-wiring WhileLoopOpen/WhileLoopClose instead, you'd probably write your own condition rather than use an internal node - although it's a perfectly good drop-in for "run this loop N times" if you do wire it: feed it your remaining count, use should_continue as the loop condition, and connect decremented back around so the count actually falls. That's literally the pattern the for-loop nodes automate.
Why it's on comfy.icu at all
Because it ships registered in the pack's class mappings (with an empty category, which is why it floats without a folder), it shows up in node listings even though the author didn't expose it in the UI. So if you're reading this page because you saw the node in a workflow or a registry and wondered what it is: it's the counter. If it appears in a saved workflow file, it's part of a for-loop's expansion and should stay put. Don't delete it from a working workflow just because it looks mysterious.
The one honest use case for touching it directly is debugging: if a for-loop runs the wrong number of times, this is where you'd add a DebugPrint-style probe to watch current_value fall. Everything else is "the pack handles it."
Install
It ships inside Akatz-Loop-Nodes (akatz-ai) - there's no separate install, and you can't install it alone. Get the pack via ComfyUI Manager (search "Akatz-Loop-Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/Akatz-Loop-Nodes
Restart ComfyUI. Pack dependency is opencv-python, no models. No troubleshooting beyond the obvious: a loop that never stops means should_continue never went false, which means something upstream never let the count reach zero - check the loop's remaining/quantity value, not this node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| current_value | INT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| decremented | INT | — |
| should_continue | BOOLEAN | — |