How is this accepted?
const std = @import("std");
pub fn main() !void {
const outcome =
std.debug.print("Hello, world\n", .{});
_ = outcome;
}
The result of std.debug.print() is void, yet binding that result to outcome produces no complaint from Zig.
I encountered this while working on a project, after incorrectly thinking an API from a third-party library produced a value when it actually didn't. Eventually, formatting that result as a string using {s} caused a compiler error, though tracing it back to my initial assumption took some time.
When would storing void in a variable be helpful?