Hello world/Newbie: Difference between revisions
add explanation for regular writing to stdout
(explain when to use Zig debug.print) |
(add explanation for regular writing to stdout) |
||
Line 2,914:
===Using standard streams===
<lang zig>
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut
// `try` is a shorthand for `fn_call() catch |err| return err;`.
try stdout.print("Hello, {}\n", .{"world"});▼
// See also documentation for `catch`, `defer` and `errdefer`
// for code flow adjustments
}
</lang>
|