mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
Merge branch 'main' of github.com:ratfactor/ziglings into main
This commit is contained in:
commit
311fe0ea3c
2 changed files with 6 additions and 6 deletions
|
@ -17,8 +17,8 @@ pub fn main() void {
|
||||||
std.debug.print("Standard Library.\n", .{});
|
std.debug.print("Standard Library.\n", .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Going deeper: imports must be declared as "constants" (with the 'const'
|
// For the curious: Imports must be declared as constants because they
|
||||||
// keyword rather than "variables" (with the 'var' keyword) is that they
|
// can only be used at compile time rather than run time. Zig evaluates
|
||||||
// can only be used at "compile time" rather than "run time". Zig evaluates
|
// constant values at compile time. Don't worry, we'll cover imports
|
||||||
// const values at compile time. Don't worry if none of this makes sense
|
// in detail later.
|
||||||
// yet! See also this answer: https://stackoverflow.com/a/62567550/695615
|
// See also this answer: https://stackoverflow.com/a/62567550/695615
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// What happens if getText() can't find 'foo.txt'? How do we express
|
// What happens if getText() can't find 'foo.txt'? How do we express
|
||||||
// this in Zig?
|
// this in Zig?
|
||||||
//
|
//
|
||||||
// Zig let's us make what's called an "error union" which is a value
|
// Zig lets us make what's called an "error union" which is a value
|
||||||
// which could either be a regular value OR an error from a set:
|
// which could either be a regular value OR an error from a set:
|
||||||
//
|
//
|
||||||
// var text: MyErrorSet!Text = getText('foo.txt');
|
// var text: MyErrorSet!Text = getText('foo.txt');
|
||||||
|
|
Loading…
Reference in a new issue