String formatting in a bit more complex cases

Great! Thanks so much

I think i just have one last question then

would that mean that this

fn version(writer: anytype) !void {
    try writer.writeAll("imagine this as a complexly formatted str thats comptime known\n");
}

pub fn main() !void {
    // argument handling

    const stdout_writer = std.io.getStdOut().writer();
    var buffered_writer = std.io.bufferedWriter(stdout_writer);
    const buffered_stdout = buffered_writer.writer();

    if (arg == "--version") {
        try version(buffered_stdout);
    }
    try buffered_writer.flush();
}

has the final string already calculated before you actually call the stdout buffered writer?
I would imagine that the calling to the stdout writer is runtime so i would need to get the string into a comptime var and then print that. But maybe thats not the case.

youve been very helpful :slight_smile: