ratfactor / ziglings

Learn the Zig programming language by fixing tiny broken programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

062_loop_expressions comptime-only type error

samrock5000 opened this issue · comments

using version v0.11.0-dev.4009+11695745e

Following the logic from the comment, adding an else 0 causes compilation errors:

exercises/062_loop_expressions.zig:49:9: error: value with comptime-only type 'comptime_int' depends on runtime control flow
        if (lang.len == 3) break lang else 0;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exercises/062_loop_expressions.zig:48:43: note: runtime control flow here
    const current_lang: []const u8 = for (langs) |lang| {
    ```