diff --git a/doc/home.html.in b/doc/home.html.in index 002ac0b70a..3b2ef3407b 100644 --- a/doc/home.html.in +++ b/doc/home.html.in @@ -70,10 +70,14 @@
  • Mersenne Twister Random Number Generator
  • Hello World

    -
    const io = @import("std").io;
    +    
    const std = @import("std");
     
     pub fn main() -> %void {
    -    %return io.stdout.printf("Hello, world!\n");
    +    // If this program is run without stdout attached, exit with an error.
    +    var stdout_file = %return std.io.getStdOut();
    +    // If this program encounters pipe failure when printing to stdout, exit
    +    // with an error.
    +    %return stdout_file.write("Hello, world!\n");
     }

    Build this with:

    zig build-exe hello.zig