From 741504862c7094dc91d3bf4c4da58e9236a7633a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 24 Nov 2017 15:06:12 -0500 Subject: [PATCH] update homepage docs --- doc/home.html.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/home.html.in b/doc/home.html.in index 002ac0b70..3b2ef3407 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