aboutsummaryrefslogtreecommitdiff
path: root/18_functions.zig
diff options
context:
space:
mode:
Diffstat (limited to '18_functions.zig')
-rw-r--r--18_functions.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/18_functions.zig b/18_functions.zig
new file mode 100644
index 0000000..07c63ec
--- /dev/null
+++ b/18_functions.zig
@@ -0,0 +1,19 @@
+//
+// Functions! FUNctions! FUN!
+//
+const std = @import("std");
+
+pub fn main() void {
+ // The new function deepThought() should return the number 42. See below.
+ const answer = deepThought();
+
+ std.debug.print("Answer to the Ultimate Question: {}\n", .{answer});
+}
+
+//
+// We're just missing a couple things here. One thing we're NOT missing is the
+// keyword 'pub', which is not needed here. Can you guess why?
+//
+??? deepThought() ??? {
+ return 42; // Number courtesy Douglas Adams
+}