diff --git a/doc/langref.html.in b/doc/langref.html.in
index f41eb2dec..2a2b4003f 100644
--- a/doc/langref.html.in
+++ b/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");
diff --git a/example/hello_world/hello.zig b/example/hello_world/hello.zig
index 8e65e06a9..cb7d5ef15 100644
--- a/example/hello_world/hello.zig
+++ b/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");