> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-claude-comfy-concurrency-limits-page-s84u33.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# StartLoop - ComfyUI Built-in Node Documentation

> Start Loop 节点在工作流内启动一个循环结构。

Start Loop 节点在工作流内启动一个循环结构。它每次迭代运行一次连接的循环体，并可以通过三种方式计算迭代次数：固定重复次数（simple）、数值索引范围（For）或对列表中的每个项目执行一次（List）。每次迭代都会暴露当前索引、首/末标志，以及一个可选携带值，该值可以从一次迭代传递到下一次迭代。

## 输入

### 通用输入

| 参数 | 描述 | 数据类型 | 必填 | 范围 |
| - | - | - | - | - |
| `mode` | 循环迭代模式（默认："simple"）。所选模式决定显示哪些额外参数。 | DYNAMIC\_COMBO | 是 | `"simple"`<br />`"For"`<br />`"List"` |
| `cache_iterations` | 重用之前执行中未更改的迭代结果。禁用以重新执行每次迭代。默认：false。 | BOOLEAN | 是 | true<br />false |
| `parent_iteration` | 连接外部 Start Loop 的 `iteration_index` 以嵌套此循环。此输入仅为强制输入（需要链接）。 | INT | 否 | 任意整数 |
| `initial_iteration_value` | 在第一次迭代时作为 `current_iteration_value` 暴露的值。 | ANY (type-matched) | 否 | 任意值 |

### Simple 模式输入

| 参数 | 描述 | 数据类型 | 必填 | 范围 |
| - | - | - | - | - |
| `num_iterations` | 执行循环体的次数。默认：4。 | INT | 是 | 最小 0 |

### For 模式输入

| 参数 | 描述 | 数据类型 | 必填 | 范围 |
| - | - | - | - | - |
| `start_iteration_index` | 使用 For 循环模式时第一次迭代的索引。默认：0。 | INT | 是 | 任意整数 |
| `max_iteration` | For 模式下 `iteration_index` 的排他停止值。默认：4。 | INT | 是 | 最大 0xffffffffffffffff |
| `step` | 使用 For 循环模式时每次迭代之间的索引步长。默认：1。 | INT | 是 | 最小 1 |

### List 模式输入

| 参数 | 描述 | 数据类型 | 必填 | 范围 |
| - | - | - | - | - |
| `list` | 循环迭代的项目列表。循环体对每个项目执行一次。 | ANY (type-matched list item) | 是 | 任意列表 |

说明：

* 仅显示和使用属于当前所选 `mode` 的参数。
* 在 Simple 模式下，迭代索引从 0 运行到 `num_iterations` 减 1。在 For 模式下，索引从 `start_iteration_index` 运行到（但不包括）`max_iteration`，每次增加 `step`。在 List 模式下，`list` 中每个项目运行一次迭代。
* `step` 不能为 0；值为 0 会引发错误。不允许小于 1 的值。
* 如果计算出的迭代次数为零，`is_last` 输出报告为 true，并且循环体不会运行。

## 输出

| 输出名称 | 描述 | 数据类型 |
| - | - | - |
| `iteration_index` | 当前循环迭代的索引。 | INT |
| `is_first` | 在循环第一次迭代期间为 true。 | BOOLEAN |
| `is_last` | 在循环最后一次迭代期间为 true。 | BOOLEAN |
| `list_item` | 使用 List 模式时列表中的当前项目。在 Simple 和 For 模式下为无。 | ANY (type-matched) |
| `current_iteration_value` | 当前迭代的循环携带值：第一次迭代时为 `initial_iteration_value`，之后每次迭代为来自 End Loop 的 `next_iteration_value`。 | ANY (type-matched) |

> 本文档由 AI 生成。如果您发现任何错误或有改进建议，欢迎贡献！ [在 GitHub 上编辑](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/StartLoop/zh.md)

***

**Source fingerprint (SHA-256):** `be34fedd4db9d4f4cc795855c87f6489f294e029da316b5dc66e5af7dff004a9`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.