4 ms·
const std = @import("std"); pub fn main() !void { const stdout = std.io.getStdOut().writer(); try stdout.print("Hello, {s}!\n", .{"world"});
by Koshkin 4y ago
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, {s}!\n", .{"world"});
}
To me, this looks worse than anything I have seen before.
- flohofwoe 4y agoAlternatively: const print = @import("std").debug.print; pub fn main() void { print("Hello {s}!", .{"World"}); } Or using the logging API: const info = @import("std").log.info; pub fn main() void { info("Hello {s}!", .{"World"}); } (I'm actually not sure why Zig doesn't have a simple way to print to stdout, but I guess there are 'reasons')
- Koshkin 4y agoZig is the ugliest of the Three Piglets (the other two being Rust and Swift).
- KRAKRISMOTT 4y agoAnd the Big Bad Go will come and blow down their houses.
- Koshkin 4y agoIndeed, Go Is Great.
- throwawaymaths 4y agoyou might not have a stdout, for example very low to the metal.