From 708436c63d8593dfa05ed358768ab7f5ba4ae840 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Wed, 1 Jul 2026 16:20:41 +0200 Subject: [PATCH] added explanation about stdout --- exercises/026_hello2.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exercises/026_hello2.zig b/exercises/026_hello2.zig index f110d87..dc1e019 100644 --- a/exercises/026_hello2.zig +++ b/exercises/026_hello2.zig @@ -30,3 +30,11 @@ pub fn main(init: std.process.Init) !void { // We just learned of a single statement which can accomplish this. 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.