diff options
author | Dave Gauer <dave@ratfactor.com> | 2021-01-19 19:46:53 -0500 |
---|---|---|
committer | Dave Gauer <dave@ratfactor.com> | 2021-01-19 19:46:53 -0500 |
commit | b02845819a661aa97ad25c3f1afc53c4b958e797 (patch) | |
tree | 69affc17936d464df63aacaeccffd2a6b7b3d4c7 /18_functions.zig | |
parent | 879593784755f24f4a5222d7cd9a77ce5bc2c11d (diff) | |
download | ziglings-b02845819a661aa97ad25c3f1afc53c4b958e797.tar.gz ziglings-b02845819a661aa97ad25c3f1afc53c4b958e797.tar.bz2 ziglings-b02845819a661aa97ad25c3f1afc53c4b958e797.tar.xz ziglings-b02845819a661aa97ad25c3f1afc53c4b958e797.zip |
Added Ex. 18 functions
Diffstat (limited to '18_functions.zig')
-rw-r--r-- | 18_functions.zig | 19 |
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 +} |