aboutsummaryrefslogtreecommitdiff
path: root/exercises/002_std.zig
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-03-12 18:59:46 -0500
committerDave Gauer <dave@ratfactor.com>2021-03-12 18:59:46 -0500
commit6ad9774189fbd64b2f2c9519f4513ab34b0c3809 (patch)
treed6c90700131d5b28e898881f13e2a05612e4703f /exercises/002_std.zig
parentbe36352572ddb18218e1830e49316c259dea5e8c (diff)
downloadziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.tar.gz
ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.tar.bz2
ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.tar.xz
ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.zip
"999 is enough for anybody" triple-zero padding (#18)
When I hit 999 exercises, I will finally have reached the ultimate state of soteriological release and no more exercises will be needed. The cycle will be complete. All that will be left is perfect quietude, freedom, and highest happiness.
Diffstat (limited to 'exercises/002_std.zig')
-rw-r--r--exercises/002_std.zig24
1 files changed, 24 insertions, 0 deletions
diff --git a/exercises/002_std.zig b/exercises/002_std.zig
new file mode 100644
index 0000000..50059e1
--- /dev/null
+++ b/exercises/002_std.zig
@@ -0,0 +1,24 @@
+//
+// Oops! This program is supposed to print a line like our Hello World
+// example. But we forgot how to import the Zig Standard Library.
+//
+// The @import() function is built into Zig. It returns a value which
+// represents the imported code. It's a good idea to store the import as
+// a constant value with the same name as the import:
+//
+// const foo = @import("foo");
+//
+// Please complete the import below:
+//
+
+??? = @import("std");
+
+pub fn main() void {
+ std.debug.print("Standard Library.\n", .{});
+}
+
+// For the curious: Imports must be declared as constants because they
+// can only be used at compile time rather than run time. Zig evaluates
+// constant values at compile time. Don't worry, we'll cover imports
+// in detail later.
+// See also this answer: https://stackoverflow.com/a/62567550/695615