# Branch Does Not Get Canceled

**URL:** <https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666>\
**Category:** Issues and Bug Reporting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, closed, fortnite, verse\
**Created:** [July 31, 2026, 4:58am UTC](https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666 "2026-07-31T04:58:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zablabior](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zablabior/32/1148291_2.png) [@Zablabior](https://forums.unrealengine.com/u/Zablabior)\
**Post date:** [July 31, 2026, 4:58am UTC](https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666/1 "2026-07-31T04:58:38Z")

</div>

### Summary

After the 10 seconds sleep, the branch expression is not getting canceled

```auto
OnBegin<override>()<suspends> : void =
    block:
        branch:
            loop:
                Print("Branch")
                Sleep(1.0)
        Sleep(10.0)
    Sleep(Inf)

```

### Please select what you are reporting on:

Verse

### What Type of Bug are you experiencing?

Verse

### Steps to Reproduce

Run the code above

### Expected Result

The branch expression should get canceled after the 10 seconds.

### Observed Result

The branch expression continues to run (“Branch” continues to be printed).

### Platform(s)

PC

### Additional Notes

If the OnBegin finishes [when removing `Sleep(Inf)`], the branch gets canceled.

---

<div class="post-metadata">

**Author:** ![Sprintermax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sprintermax/32/1037175_2.png) [@Sprintermax](https://forums.unrealengine.com/u/Sprintermax)\
**Post date:** [July 31, 2026, 4:04pm UTC](https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666/3 "2026-07-31T16:04:01Z")

</div>

We have so many issues with structured concurrency related to `defer` and `branch` ☹  
Also excluding the fact that it is confusing and hard to remember specifically each case if is a bug or intendeed…

Can you place `defer` statements inside that branch and the block, to check if they run?

> **[Defer Statements - Control Flow - Book of Verse](https://verselang.github.io/book/07_control/#defer-statements)**
>
> Every program has a natural rhythm to its execution, a sequence in which instructions are processed and decisions are made. In Verse, this flow is more than just a mechanical progression through lines of code - it is a carefully orchestrated dance...

Defer and Branch should have the same “scope rules” as mentioned on this page above.

```verse
OnBegin<override>()<suspends> : void =
    block:
        defer. Print("Hello 1")
        branch:
            defer. Print("Hello 2")
            loop:
                Print("Branch")
                Sleep(1.0)
        Sleep(10.0)
        defer. Print("Hello 3")
    Sleep(Inf)

```

It should print:

```txt
Branch
Branch
[...]
Branch
Hello 2
Hello 3
Hello 1

```

If defer prints but branch is kept running, then I have no idea. If the defer does not print, something is wrong with the way the verse handles the logic ☹

---

<div class="post-metadata">

**Author:** ![Zablabior](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zablabior/32/1148291_2.png) [@Zablabior](https://forums.unrealengine.com/u/Zablabior)\
**Post date:** [July 31, 2026, 5:37pm UTC](https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666/4 "2026-07-31T17:37:31Z")

</div>

Tried here. Hello 2 never gets printed and the branch loop continues to run after the 10 seconds

---

<div class="post-metadata">

**Author:** ![Bug-Reporter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bug-reporter/32/1223650_2.png) [@Bug-Reporter](https://forums.unrealengine.com/u/Bug-Reporter)\
**Post date:** [August 11, 2026, 8:00pm UTC](https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666/6 "2026-08-11T20:00:19Z")

</div>

FORT-1133207 has been ‘Closed’. This is working as intended by design.

---

<div class="post-metadata">

**Author:** ![Sprintermax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sprintermax/32/1037175_2.png) [@Sprintermax](https://forums.unrealengine.com/u/Sprintermax)\
**Post date:** [August 12, 2026, 11:22am UTC](https://forums.unrealengine.com/t/branch-does-not-get-canceled/2739666/7 "2026-08-12T11:22:15Z")

</div>

This is confusing, why does `defer` consider blocks a new enclosing scope, but `branch` does not?

We have issues for so long related to these conflicts. On the past, different epic devs also gave different answers when me and others made related questions.  
Looks like there is no common consensus about how they should work…

This section on the book talking about scopes was made after a talk that I had with the language devs related to these complains, with the goal of making clear and easy to consult if we get confused by it.

In a perfect scenario, we would be able to “attach” the defer/branch to where we want (function scope, block scope, etc). But we can’t do that, and when we make bug reports of it about both behaviors, they get both closed which is clearly weird. How can they be both “correct” and both “wrong” at same time?

 ![Screenshot_20260812_081250_Edge](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/f/0ff64ee1f51aa31827daafb280ca96c8107cc819.png)
