update homepage docs

master
Andrew Kelley 2017-11-24 15:06:12 -05:00
parent 5a25505668
commit 741504862c
1 changed files with 6 additions and 2 deletions

View File

@ -70,10 +70,14 @@
<li><a href="#mersenne">Mersenne Twister Random Number Generator</a></li> <li><a href="#mersenne">Mersenne Twister Random Number Generator</a></li>
</ul> </ul>
<h3 id="hello">Hello World</h3> <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 { 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> }</code></pre>
<p>Build this with:</p> <p>Build this with:</p>
<pre>zig build-exe hello.zig</pre> <pre>zig build-exe hello.zig</pre>