mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-07-28 18:25:16 +00:00
added explanation about stdout
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user