For Loop (Range)
When your ComfyUI batch needs to skip every other seed
- index
SimpleForLoopRange - shown in the UI as "For Loop (Range)" - is the fancier sibling of the same pack's count loop. Same idea, more control. Instead of "run this graph N times starting at zero," it lets you say exactly which values you want the graph to run with: start at 3, end before 11, step by 2. Python people will recognize it immediately, because it's a thin wrapper around range(start, stop, step).
You'd pick this over the count version when the loop variable itself matters. Skipping every other seed? Start a sweep somewhere other than 0? Need more than the count node's 100-iteration ceiling? This is the one.
How it works
Same mechanism as its sibling: it emits a list of integers, and ComfyUI's built-in list execution runs every downstream node once per value. There's nothing clever about the implementation - the node literally calls list(range(start, stop, step)) and hands the result out. Which means it inherits the same honest limitation: no state carried between iterations, no feedback. Fan-out, not a stateful loop. Fine for sweeps, wrong for chained refinement.
The three inputs that matter
- start (INT, default 0) - first value emitted.
- stop (INT, default 10) - exclusive upper bound. The list ends before it, never including it.
- step (INT, default 1) - how much each value jumps. Minimum 1.
Output is index, an INT list of every value in the range, wired into whatever you want to vary per run - seed, CFG, strength, prompt picker.
The exclusive stop is where everyone trips. Want ten values starting at zero? That's start=0, stop=10, not stop=9 - the latter gives you nine. And because step can't be negative, you can't count down. Descending order isn't possible directly; generate ascending and reverse it, or map the index.
Install
Identical to the rest of the pack - this ships in the same repo, so installing it installs both. ComfyUI Manager → search ComfyUI_LoopNode, or:
cd ComfyUI/custom_nodes
git clone https://github.com/t22m003/ComfyUI_LoopNode.git
Restart, and you'll find both nodes under the Loop category. No requirements to pip-install, no models to download, nothing platform-specific - pure Python, works anywhere.
The honest take
For the twenty-something impressions this page gets, it's doing fine: this is a genuinely thin utility. If you don't need custom starts, steps, or iteration counts past 100, the count node is the simpler reflex. But the moment you're doing a seed grid with gaps - seeds 0, 2, 4, 6 to check how far apart two seeds need to be before the images stop looking related - this is the one that saves you the mapping node. Small pack, both nodes, and the range version is the one you graduate to.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| start | INT | 00–10000 | — |
| stop | INT | 100–10000 | — |
| step | INT | 11–10000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| index | INT | — |