# 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:\
[#pre-data](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/..#pre-data "mention")&#x20;
{% endhint %}
