Sobeston / zig.guide

Repo for https://zig.guide content. Get up to speed with Zig quickly.
https://zig.guide
MIT License
689 stars 177 forks source link

chapter 1: The len declared in "const len = @import("std").mem.len;" is not used. #173

Closed zigo101 closed 1 year ago

zigo101 commented 1 year ago

In the the piece of code:

const len = @import("std").mem.len;

test "vector looping" {
    const x = Vector(4, u8){ 255, 0, 255, 0 };
    var sum = blk: {
        var tmp: u10 = 0;
        var i: u8 = 0;
        while (i < 4) : (i += 1) tmp += x[i];
        break :blk tmp;
    };
    try expect(sum == 510);
}