Commit 45081c1e9c

Andrew Kelley <andrew@ziglang.org>
2018-12-23 19:56:49
hello world example can use `const` instead of `var`
1 parent 218a4d4
Changed files (2)
doc
example
hello_world
doc/langref.html.in
@@ -165,7 +165,7 @@ const std = @import("std");
 
 pub fn main() !void {
     // If this program is run without stdout attached, exit with an error.
-    var stdout_file = try std.io.getStdOut();
+    const stdout_file = try std.io.getStdOut();
     // If this program encounters pipe failure when printing to stdout, exit
     // with an error.
     try stdout_file.write("Hello, world!\n");
example/hello_world/hello.zig
@@ -2,7 +2,7 @@ const std = @import("std");
 
 pub fn main() !void {
     // If this program is run without stdout attached, exit with an error.
-    var stdout_file = try std.io.getStdOut();
+    const stdout_file = try std.io.getStdOut();
     // If this program encounters pipe failure when printing to stdout, exit
     // with an error.
     try stdout_file.write("Hello, world!\n");