Consistent instructions and examples
I started off with "hints" that required the poor student to piece together the information from incomplete bits. A complete example is like a picture that is worth 1000 words and far clearer.
This commit is contained in:
parent
507355ec3b
commit
adf5ddb27d
16 changed files with 185 additions and 89 deletions
15
02_std.zig
15
02_std.zig
|
|
@ -2,13 +2,16 @@
|
|||
// Oops! This program is supposed to print a line like our Hello World
|
||||
// example. But we forgot how to import the Zig Standard Library.
|
||||
//
|
||||
// Hint 1: The @import() built-in function returns a value representing
|
||||
// imported code. We need to give that value a name to use it.
|
||||
// Hint 2: We use the name "std" in the main function (see below).
|
||||
// Hint 3: Imports need to be named by declaring them as "const" values.
|
||||
// Hint 4: Take a look at how the previous exercise did this!
|
||||
// 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:
|
||||
//
|
||||
@import("std");
|
||||
// const foo = @import("foo");
|
||||
//
|
||||
// Please complete the import below:
|
||||
//
|
||||
|
||||
??? = @import("std");
|
||||
|
||||
pub fn main() void {
|
||||
std.debug.print("Standard Library.\n", .{});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue