diff options
author | Dave Gauer <dave@ratfactor.com> | 2021-02-09 18:36:57 -0500 |
---|---|---|
committer | Dave Gauer <dave@ratfactor.com> | 2021-02-09 18:36:57 -0500 |
commit | 55ad7c32f2d534b1fbd438204d21738f958c51a5 (patch) | |
tree | 16be4b53193105a759b3eec25be5e664d41c428d /exercises/02_std.zig | |
parent | cf0920de31e9b5f3c5ba6de19a1b4c8d0c58b907 (diff) | |
download | ziglings-55ad7c32f2d534b1fbd438204d21738f958c51a5.tar.gz ziglings-55ad7c32f2d534b1fbd438204d21738f958c51a5.tar.bz2 ziglings-55ad7c32f2d534b1fbd438204d21738f958c51a5.tar.xz ziglings-55ad7c32f2d534b1fbd438204d21738f958c51a5.zip |
Moved exercises to exercises because exercises
Diffstat (limited to 'exercises/02_std.zig')
-rw-r--r-- | exercises/02_std.zig | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/exercises/02_std.zig b/exercises/02_std.zig new file mode 100644 index 0000000..dcc1b87 --- /dev/null +++ b/exercises/02_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", .{}); +} + +// Going deeper: imports must be declared as "constants" (with the 'const' +// keyword rather than "variables" (with the 'var' keyword) is that they +// can only be used at "compile time" rather than "run time". Zig evaluates +// const values at compile time. Don't worry if none of this makes sense +// yet! See also this answer: https://stackoverflow.com/a/62567550/695615 |