From 1d134ae04b77e2d85e3e719d09c20075eccc1e94 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Thu, 24 Dec 2020 21:42:31 +0000 Subject: [PATCH] check_os simplification --- check_os.zig | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/check_os.zig b/check_os.zig index 4a9da75..c19464c 100644 --- a/check_os.zig +++ b/check_os.zig @@ -2,15 +2,10 @@ const std = @import("std"); const builtin = @import("builtin"); pub fn main() !void { - switch (builtin.os.tag) { - .windows => { - std.debug.print("hello windows OS: {}\n", .{builtin.os.tag}); - }, - .linux => { - std.debug.print("hello linux-based OS: {}\n", .{builtin.os.tag}); - }, - else => { - std.debug.print("hello mystery OS: {}\n", .{builtin.os.tag}); - }, - } + const name = switch (builtin.os.tag) { + .windows => "windows", + .linux => "linux", + else => "mystery", + }; + std.debug.print("hello {}\n", .{name}); }