added explanation about stdout

This commit is contained in:
Chris Boesch
2026-07-01 16:20:41 +02:00
parent e65b359055
commit 708436c63d
+8
View File
@@ -30,3 +30,11 @@ pub fn main(init: std.process.Init) !void {
// We just learned of a single statement which can accomplish this. // We just learned of a single statement which can accomplish this.
stdout.print("Hello world!\n", .{}); stdout.print("Hello world!\n", .{});
} }
// Now you must be thinking "Why would I need to do this instead of good
// old `std.debug.print()`?", but here's what you need to understand:
// `std.debug.print()` prints its output to stderr, while the stdout_writer
// approach prints to stdout.
// A common practice is to pipe output of a command to other commands,
// and in order for the piping to work, those commands expect thier input
// to come from stdout, not stderr.