Back to course

Command Line Arguments

Full Course: Zig Programming From Zero to Hero

CLI Arguments

To access command-line arguments, use the iterator provided by the standard library.

zig var args = try std.process.argsWithAllocator(allocator); defer args.deinit();

while (args.next()) |arg| { std.debug.print("Arg: {s}\n", .{arg}); }