> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://documentation.celestory.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🟦 Loop through a list

# 🟦 Loop through a list

${frame}[Video: anatomy of the Loop through a list block](https://celestory-docs-videos.netlify.app/en/anatomie-bloc/loopthroughlist.html)

![Loop through a list](https://celestory-docs-illustrations.netlify.app/en/Loopthroughalist_EN.svg)

The Loop through a list block allows you to iterate over each element of a list to process them individually, like a Foreach loop in programming.

This block is essential for automating repetitive processing on data collections, such as generating dynamic interfaces or performing aggregate calculations.

## 📥 Entries

- in (Stream): Entry point that starts (or restarts) looping through the list.
- list (List/Table): The data source to browse. A list of texts, numbers, booleans or images.

## 📤 Outings

- value (Type of the list items): Value of the current element during each iteration. This output only appears once a list is connected or chosen, and is labelled « value » on the block.
- index (Number): Numerical position of the current element in the list (starts at 1).
- out (Stream): Signal triggered once per element to execute the associated processing.
- end (Stream): Single signal triggered after the last element, marking the end of the loop.

## 💡 Example of use

${frame}[Video: the Loop through a list block](https://celestory-docs-videos.netlify.app/en/graphe-blocs/parcourir-une-liste.html)

Scenario: Calculate the total of a shopping cart

1. You have a basket variable containing a list of prices: [12.99, 5.50, 8.00, 3.25].
1. Connect shopping cart to the list input of the Browse a list block.
1. Bind the value output to a Calculate block to add each price to a total variable.
1. Connect the out output to the execution flow of the Calculate block.
1. At each iteration, the current price is added to the total (12.99 → 5.50 → 8.00 → 3.25).
1. Once all elements have been processed, the end output triggers the display of the final total (€30.74) via a Dynamic Text block.

## ⚙️ Technical Details

- Type management: The type of the value output automatically adapts to the content of the list.
- Order of execution: Elements are processed sequentially, from first to last.
- Performance: Avoid blocking operations in the loop to avoid slowing down the flow.
- Edge case: If the list is empty, only the end output is triggered immediately.

---

*Documented version: v1*