# For Each Loop - List

Iterates over all elements in the specified List, assigning the current element to the variable specified in the "Element" property during each iteration of the loop, and then the execution of the script continues towards the exit "Element" of this block (into the so-called "loop body").

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-917029473627636af484987bfb591e1877e0ad54%2F%D0%B1%D0%BB%D0%BE%D0%BA%20%D1%86%D0%B8%D0%BA%D0%BB%20%D0%B4%D0%BB%D1%8F%20%D0%BA%D0%B0%D0%B6%D0%B4%D0%BE%D0%B3%D0%BE.png?alt=media" alt=""><figcaption></figcaption></figure>

After iterating through all elements of the list, the execution of the script continues towards the lower exit of the block. Don't forget to connect the exit of the last block in the loop body to the entry of this block.

<table data-header-hidden><thead><tr><th width="246" valign="top"></th><th width="307" valign="top"></th></tr></thead><tbody><tr><td valign="top">List</td><td valign="top">[List] The list whose elements need to be iterated over in the loop.</td></tr><tr><td valign="top">Element</td><td valign="top">[Object] The variable that will be assigned the current element of the list during each pass of the loop.</td></tr><tr><td valign="top">Element Index</td><td valign="top">[Number] The ordinal number of the element. Numbering starts from zero.</td></tr><tr><td valign="top">Error Handling Level</td><td valign="top"><p>Select the error handling level. Possible values:</p><ul><li>"Default" - by default;</li><li>"Ignore" - errors are ignored;</li><li>"Handle" - errors are handled.</li></ul><p>If "Default" is selected, the value of the "Start" block of this diagram will be used.</p></td></tr><tr><td valign="top">Exit Direction</td><td valign="top"><p>Select the exit direction from the block in case of an error. Possible values:</p><ul><li>"Default" - by default;</li><li>"Right" - to the right;</li><li>"Bottom" - down.</li></ul><p>This property allows you to determine the exit direction in case of errors for blocks that do not contain the "If Error" connector (for example, the "Condition" block).</p><p>If "Default" is selected, the value of the "Start" block of this diagram will be used.</p></td></tr><tr><td valign="top">Message Level</td><td valign="top"><p>Select the message level that the blocks will output during operation. Possible values:</p><ul><li>"Default" - by default;</li><li>"Release" - output is disabled;</li><li>"Debug" - main information output;</li><li>"Detailed" - detailed information output.</li></ul><p>If "Default" is selected, the value of the "Start" block of this diagram will be used.</p></td></tr><tr><td valign="top">Error Text</td><td valign="top">[Text] Returns detailed information about the error in case of incorrect execution of the block's work.</td></tr></tbody></table>
