On programme to version?

hello

In a program, can we retrieve the version number, either 0.11.0 or 0.12.0, and do the following:

const version = // retrieve the version number;  ??????

if (version == "0.11.0") {
    const iter_dir = try std.fs.cwd().openIterableDir(vdir, .{});
} else if (version == "0.12.0") {
    const iter_dir = std.fs.cwd().openDir(vdir, .{ .iterate = true }) catch unreachable;
}

Yes,

const version = @import("builtin").zig_version_string;
2 Likes

I would have liked to condition my source code based on the compiler version. It’s not working, but at the same time, I think it’s normal.

4 Likes