From b02845819a661aa97ad25c3f1afc53c4b958e797 Mon Sep 17 00:00:00 2001 From: Dave Gauer Date: Tue, 19 Jan 2021 19:46:53 -0500 Subject: Added Ex. 18 functions --- 18_functions.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 18_functions.zig (limited to '18_functions.zig') 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 +} -- cgit v1.2.3-ZIG