# code-block-pro/1.27.6/build/shiki/samples/zig.sample

Code Block Pro – Beautiful Syntax Highlighting, version 1.27.6. 26 lines.

- Page: https://pluginprobe.com/plugins/code-block-pro/1.27.6/code/build/shiki/samples/zig.sample
- Raw: https://pluginprobe.com/plugins/code-block-pro/1.27.6/raw/build/shiki/samples/zig.sample
- Modified: 2023-09-03T01:04:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-block-pro/1.27.6/code/build/shiki/samples/zig.sample#L10-L20`.

```
const std = @import("std");
const parseInt = std.fmt.parseInt;

test "parse integers" {
    const input = "123 67 89,99";
    const ally = std.testing.allocator;

    var list = std.ArrayList(u32).init(ally);
    // Ensure the list is freed at scope exit.
    // Try commenting out this line!
    defer list.deinit();

    var it = std.mem.tokenize(u8, input, " ,");
    while (it.next()) |num| {
        const n = try parseInt(u32, num, 10);
        try list.append(n);
    }

    const expected = [_]u32{ 123, 67, 89, 99 };

    for (expected, list.items) |exp, actual| {
        try std.testing.expectEqual(exp, actual);
    }
}

// from https://ziglang.org
```
