| ... | @@ -264,15 +264,14 @@ | ... | @@ -264,15 +264,14 @@ |
| 264 | please <a href="https://github.com/zig-lang/www.ziglang.org/issues/new?title=I%20searched%20for%20___%20in%20the%20docs%20and%20didn%27t%20find%20it">file an issue</a> or <a href="https://webchat.freenode.net/?channels=%23zig">say something on IRC</a>. | 264 | please <a href="https://github.com/zig-lang/www.ziglang.org/issues/new?title=I%20searched%20for%20___%20in%20the%20docs%20and%20didn%27t%20find%20it">file an issue</a> or <a href="https://webchat.freenode.net/?channels=%23zig">say something on IRC</a>. |
| 265 | </p> | 265 | </p> |
| 266 | <h2 id="hello-world">Hello World</h2> | 266 | <h2 id="hello-world">Hello World</h2> |
| 267 | <pre><code class="zig">const io = @import("std").io; | 267 | <pre><code class="zig">const std = @import("std"); |
| 268 | | 268 | |
| 269 | pub fn main() -&gt; %void { | 269 | pub fn main() -&gt; %void { |
| 270 | // If this program is run without stdout attached, exit with an error. | 270 | // If this program is run without stdout attached, exit with an error. |
| 271 | var stdout_file = %return io.getStdOut(); | 271 | var stdout_file = %return std.io.getStdOut(); |
| 272 | const stdout = &amp;stdout_file.out_stream; | | |
| 273 | // If this program encounters pipe failure when printing to stdout, exit | 272 | // If this program encounters pipe failure when printing to stdout, exit |
| 274 | // with an error. | 273 | // with an error. |
| 275 | %return stdout.print("Hello, world!\n"); | 274 | %return stdout_file.write("Hello, world!\n"); |
| 276 | }</code></pre> | 275 | }</code></pre> |
| 277 | <pre><code class="sh">$ zig build-exe hello.zig | 276 | <pre><code class="sh">$ zig build-exe hello.zig |
| 278 | $ ./hello | 277 | $ ./hello |