> For the complete documentation index, see [llms.txt](https://docs.streamavatars.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/yieldbreak.md).

# yieldBreak

```lua
return function
    local x = 0;
    while x < 5000 do
    
        yield(); --yield works in combination with deltaTime
        
        if x > 30 then
            yieldBreak(); --causes this coroutine to close out immediately
        end
        
        --without yield, the application would freeze & be stuck in a loop.
        --until x is equal to 5000
        x = x + 1;
    end
    
    log('this will never be reached.');
end
```

{% hint style="success" %}
Find details on deltaTime at this link:\
[API Reference & Tips](/lua-scripting-api/api-reference-and-tips.md#pre-data)&#x20;
{% endhint %}
