Skip to content

Commit

Permalink
exercises(all-your-base): example: fix for Zig 0.12.0-dev (#367)
Browse files Browse the repository at this point in the history
Resolve this error, which occurs with the latest Zig master release:

    $ zig version
    0.12.0-dev.2341+92211135f
    $ bin/run-tests all-your-base
    Running tests for all-your-base...
    all_your_base.zig:30:9: error: local variable is never mutated
        var result = try list.toOwnedSlice();
            ^~~~~~
    all_your_base.zig:30:9: note: consider using 'const'
  • Loading branch information
ee7 authored Jan 25, 2024
1 parent fb3b1c8 commit 7c1dc95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exercises/practice/all-your-base/.meta/example.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn fromBase10(allocator: mem.Allocator, num: u32, output_base: u32) mem.Allocato
n /= output_base;
}
if (list.items.len == 0) try list.append(0);
var result = try list.toOwnedSlice();
const result = try list.toOwnedSlice();
mem.reverse(u32, result);
return result;
}
Expand Down

0 comments on commit 7c1dc95

Please sign in to comment.