From 0b1c468f39bcebbc03e3233a8fdfe02435c232d4 Mon Sep 17 00:00:00 2001
From: cshamback <149506027+cshamback@users.noreply.github.com>
Date: Thu, 24 Apr 2025 11:48:59 -0500
Subject: [PATCH] Update looping.md
Added link to While Loop documentation (hard to find starting from this page). Also fixed some minor grammar/syntax errors.
---
docs/workflow/looping.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/docs/workflow/looping.md b/docs/workflow/looping.md
index 9c98346..e50c2b7 100644
--- a/docs/workflow/looping.md
+++ b/docs/workflow/looping.md
@@ -10,24 +10,25 @@ Looping is helpful when you want to process multiple similar items, for example
1. Use the [Loop Data block](../blocks/loop-data.md) to loop through a [variable](./variables.md), [table](./table.md), [google sheets](../blocks/google-sheets.md) or custom JSON Array.
2. Use the [Loop Elements](../blocks/loop-elements.md) block to loop through elements on the page.
-3. Use the [Repeat Task block](../blocks/repeat-task.md) for repeatedly doing actions a specified number of times.
+3. Use the [Repeat Task block](../blocks/repeat-task.md) to repeat actions a specified number of times.
+4. Use the [While Loop block](../blocks/while-loop.md) to repeat actions a variable number of times.
## Using the Loop Data or Loop Elements Block
-When using the [Loop Data](../blocks/log-data.md) or [Loop Elements block](../blocks/loop-elements.md), the [Loop Breakpoint](../blocks/loop-breakpoint.md) must include in the workflow. The Loop Breakpoint is for telling the workflow where the scope of the loop is. And inside the Loop Breakpoint, you also must input the Loop id of the loop block.
+When using the [Loop Data](../blocks/log-data.md) or [Loop Elements block](../blocks/loop-elements.md), the [Loop Breakpoint](../blocks/loop-breakpoint.md) must be included in the workflow. The Loop Breakpoint tells the workflow where the scope of the loop is. Inside the Loop Breakpoint, you also must input the Loop ID of the loop block.

The above workflow will repeatedly execute the Forms and the Get Text block based on the numbers of the items. And after it loops all the items, the workflow will continue to the Export Data block.
-And when you're not defining the loop scope using the Loop Breakpoint block, the looping will not work.
+If you don't define the scope of the loop using the Loop Breakpoint block, the loop will not work.

The above will execute the Forms and the Get Text block once and then continue to the Export Data block.
### Access Loop Item
-You can use [expressions](./expressions.md) to access data from the current loop iteration inside the loop scope. For example, {{loopData.loopId}}; replace the `loopId` with the Loop id you inputted inside the Loop Data or Loop Element block.
+You can use [expressions](./expressions.md) to access data from the current loop iteration inside the loop scope. For example, {{loopData.loopId}}; replace the `loopId` with the Loop ID you input inside the Loop Data or Loop Element block.

@@ -38,7 +39,7 @@ The {{loopData.loopId}} expression will return:
"$index": 1
}
```
-So if you want to access the index of the loop, you can use [expressions](./expressions.md) like {{loopData.loopId.$index}}; And to get the loop value, you don't need to write the `data` property like {{loopData.loopId.data}}; Automa will automatically assign it to the expressions. But if you use [JavaScript expressions](./expressions.md#javascript-expressions), you must include the `data` property !!{{loopData.loopId.data}}
+If you want to access the index of the loop, you can use [expressions](./expressions.md) like {{loopData.loopId.$index}}; And to get the loop value, you don't need to write the `data` property like {{loopData.loopId.data}}; Automa will automatically assign it to the expressions. But if you use [JavaScript expressions](./expressions.md#javascript-expressions), you must include the `data` property !!{{loopData.loopId.data}}
## Using the Repeat Task Block
@@ -46,4 +47,4 @@ Using the [Repeat Task block](../blocks/repeat-task.md) is the easiest way to do

-The above will start to repeat to execute from the Click Element block, and after it executes three times. The workflow will continue to the New Tab block.
+The above will start from the Click Element block, and after it executes three times, the workflow will continue to the New Tab block.