mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
hello world example can use const instead of var
This commit is contained in:
parent
218a4d4b30
commit
45081c1e9c
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user