# Loop

> Run the nested blocks a fixed number of times.

- ID: `loop_basic`
- Type: Loop
- Category: [Logic](https://inventor.bot/docs/reference/blocks/logic.md)

- Loop block: write `for item := range loop_basic(Args{...}) { ... }` and read the current item's outputs from `item`. See loops.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `iterations` | yes | Number of times to run the loop body. | e.g. `"3"` |
| `body` |  | Blocks to run each iteration. | blocks: `func() { ... }` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `current_iteration` | 1-based index of the current loop run. | e.g. `"1"` |
| `total_iterations` | Total number of times this loop will run. | e.g. `"5"` |

**Example**

```go
for range loop_basic(Args{iterations: 3}) {
	send_text_message(Args{channel_id: trigger.channel_id, message_content: "Next item"})
}
```