# Looping

> :::note
Related configuration: read [Multi‑instance execution for collection, item alias, and aggregation](https://docs.uipath.com/maestro/automation-suite/2.2510/user-guide/markers-implementation).
:::

## Same task over a list, one by one (sequential multi‑instance)

:::note
Related configuration: read [Multi‑instance execution for collection, item alias, and aggregation](https://docs.uipath.com/maestro/automation-suite/2.2510/user-guide/markers-implementation).
:::

![A multi‑instance task that iterates sequentially through a list.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-a-multi-instance-task-that-iterates-sequentially-through-a-list-620723-1956df0c.webp)

**Use when**

* Tasks must occur in order.
* Each step depends on a prior result.
* Sequence integrity matters.

**Pattern in simple words**

1. Start.
2. Service task with sequential multi‑instance: Reconcile transaction over the collection.
3. End All reconciled.

      :::note
      Sequential mode preserves order.
      :::

   **Other scenarios**

* Finance: Post invoice lines in sequence.
* Insurance: Review claims in received order.
* Healthcare: Process test results per patient.
* Retail: Approve store returns sequentially.
* Manufacturing: Inspect items per batch.

## Same task over a list, all at once (parallel multi‑instance)

  ![A multi‑instance task that runs all items concurrently and produces a combined result.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-a-multi-instance-task-that-runs-all-items-concurrently-and-produces-a-combined-result-620727-235d0398.webp)

**Use when**

* Items are independent.
* Items are independent
* Order does not affect outcome.

**Pattern in simple words**

1. Start.
2. Service task with parallel multi‑instance: Run security scan for each server in the collection.
3. User task: Review results.
4. End Scan complete.

   :::note
   Use aggregation to collect per‑item outputs.
   :::

   **Other scenarios**

* Finance: Client credit checks simultaneously.
* Insurance: Evaluate multiple policies in parallel.
* Manufacturing: Inspect multiple lines concurrently.
* Retail: Update store prices at once.
* Public sector: Review permits across districts together.

## Nested repetition inside a subprocess

  ![An outer sequential loop over batches with an inner parallel loop over items.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-an-outer-sequential-loop-over-batches-with-an-inner-parallel-loop-over-items-620731-6600ff99.webp)

**Use when**

* Two levels of iteration exist, such as batch and item.
* You need a clean structure that keeps loops organized.

**Pattern in simple words**

1. Start.
2. Subprocess with sequential multi‑instance: Inspect batch, one batch at a time.
   * Inside the subprocess: Service task with parallel multi‑instance: Inspect item for each item in the batch.
3. End Batch complete.

   :::note
   Use sequential outer and parallel inner when batches must not overlap.
   :::

   **Other scenarios**

* Finance: Process monthly statements with multiple entries.
* Healthcare: Audit patients by department.
* Retail: Reconcile store sales by region.
* Manufacturing: Audit batches by product line.
* Insurance: Review claims by policy group.
