# Comptime control flow inside runtime block

**URL:** <https://ziggit.dev/t/comptime-control-flow-inside-runtime-block/4962>\
**Category:** Explain\
**Tags:** language\
**Created:** [July 3, 2024, 1:34pm UTC](https://ziggit.dev/t/comptime-control-flow-inside-runtime-block/4962 "2024-07-03T13:34:42Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![00JCIV00](https://ziggit.dev/user_avatar/ziggit.dev/00jciv00/32/1069_2.png) [@00JCIV00](https://ziggit.dev/u/00JCIV00)\
**Post date:** [December 24, 2024, 8:40pm UTC](https://ziggit.dev/t/comptime-control-flow-inside-runtime-block/4962/8 "2024-12-24T20:40:38Z")

</div>

There’s a small “hack” you can use in these situations as well. You simply `break` from the block instead of continuing the loop. This will jump you straight to the next unrolled block of the `inline for` loop at runtime and works effectively as a continue.

Example from your original code:

```zig
fn decodeUnion(comptime T: type, fbs: *FBS) !T {
    const starting_position = try fbs.getPos();
    inline for (comptime std.meta.fields(T)) |union_field| inlineCont: {
        const res = decodeFbs(union_field.type, fbs) catch |err| switch (err) {
            error.Invalid, error.EndOfStream => {
                try fbs.seekTo(starting_position);
                break :inlineCont;
            },
        };
        return res;
    } else {
        return error.Invalid;
    }
    unreachable;
}

```

---

_[View the full topic](https://ziggit.dev/t/comptime-control-flow-inside-runtime-block/4962)._
