zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 741504862c7094dc91d3bf4c4da58e9236a7633a (tree)
parent 5a25505668bac9aed0ad8f3b23fe81c6aff29b71
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Fri, 24 Nov 2017 15:06:12 -0500

update homepage docs

Diffstat:
Mdoc/home.html.in | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/home.html.in b/doc/home.html.in @@ -70,10 +70,14 @@ <li><a href="#mersenne">Mersenne Twister Random Number Generator</a></li> </ul> <h3 id="hello">Hello World</h3> - <pre><code class="zig">const io = @import("std").io; + <pre><code class="zig">const std = @import("std"); pub fn main() -&gt; %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"); }</code></pre> <p>Build this with:</p> <pre>zig build-exe hello.zig</pre>