> From the BotGhost docs: https://botghost.com/docs/custom-commands-and-events/actions/loop-actions/stop-a-loop
> Every page: https://botghost.com/docs/llms.txt

# Stop a Loop

![](https://botghost.com/docs/content/assets/workspace/image_2024-05-30_163804524.png)

The Stop a Loop block will allow users to stop a loop before it has looped the total count set in the **Run a Loop block**, this will be incredibly helpful when you only want the loop to keep going if a condition is not met.

> **Note:** This block has to be under the "Loop x times" block, which means you can't use it before the loop itself or under the "After loop" block

![](https://botghost.com/docs/content/assets/workspace/image%20(607).png)

This block requires no settings as it works directly with the [**Run a Loop**](https://botghost.com/docs/custom-commands-and-events/actions/loop-actions/run-a-loop) block. You can use this block with conditions to do a conditional stop on a loop before it has looped through the total loop count set on the **Run a Loop** block.
