zig/example/hello_world/hello.zig
Andrew Kelley 9e234d4208 breaking change to std.io API
* Merge io.InStream and io.OutStream into io.File
 * Introduce io.OutStream and io.InStream interfaces
   - io.File implements both of these
 * Move mem.IncrementingAllocator to heap.IncrementingAllocator

Instead of:

```
%return std.io.stderr.printf("hello\n");
```

now do:

```
std.debug.warn("hello\n");
```

To print to stdout, see `io.getStdOut()`.

 * Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-31 04:47:55 -04:00

11 lines
369 B
Zig

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