mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-08-02 14:45:36 +00:00
Merge branch 'main' into i278
This commit is contained in:
commit
bc96d06da4
|
@ -73,7 +73,7 @@ the appropriate tag.
|
|||
The Zig language is under very active development. In order to be
|
||||
current, Ziglings tracks **development** builds of the Zig
|
||||
compiler rather than versioned **release** builds. The last
|
||||
stable release was `0.14.0`, but Ziglings needs a dev build with
|
||||
stable release was `0.14.1`, but Ziglings needs a dev build with
|
||||
pre-release version "0.15.0" and a build number at least as high
|
||||
as that shown in the example version check above.
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
//
|
||||
// "void" is a _type_, not a value. It is the most popular of the
|
||||
// Zero Bit Types (those types which take up absolutely no space
|
||||
// and have only a semantic value. When compiled to executable
|
||||
// and have only a semantic value). When compiled to executable
|
||||
// code, zero bit types generate no code at all. The above example
|
||||
// shows a variable foo of type void which is assigned the value
|
||||
// of an empty expression. It's much more common to see void as
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
// const MyBar = Bar(); // store the struct type
|
||||
// const bar = Bar() {}; // create instance of the struct
|
||||
//
|
||||
// * The value of @typeName(Bar()) is "Bar()".
|
||||
// * The value of @typeName(MyBar) is "Bar()".
|
||||
// * The value of @typeName(@TypeOf(bar)) is "Bar()".
|
||||
// * The value of @typeName(Bar()) is "<filename>.Bar()".
|
||||
// * The value of @typeName(MyBar) is "<filename>.Bar()".
|
||||
// * The value of @typeName(@TypeOf(bar)) is "<filename>.Bar()".
|
||||
//
|
||||
// You can also have completely anonymous structs. The value
|
||||
// of @typeName(struct {}) is "struct:<position in source>".
|
||||
// of @typeName(struct {}) is "<filename>.<function>__struct_<nnn>".
|
||||
//
|
||||
const print = @import("std").debug.print;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
// variety of formatting instructions. It's basically a tiny
|
||||
// language of its own. Here's a numeric example:
|
||||
//
|
||||
// print("Catch-{x:0>4}.", .{twenty_two});
|
||||
// print("Catch-0x{x:0>4}.", .{twenty_two});
|
||||
//
|
||||
// This formatting instruction outputs a hexadecimal number with
|
||||
// leading zeros:
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
// }
|
||||
// break;
|
||||
// }
|
||||
// std.debug.print("This statement cannot be reached\n", .{});
|
||||
// std.debug.print("This statement cannot be reached\n", .{});
|
||||
// }
|
||||
//
|
||||
// By combining all we've learned so far, we can now proceed with a labeled switch
|
||||
// By combining all we've learned so far, we can now proceed with a labeled switch.
|
||||
//
|
||||
// A labeled switch is some extra syntactic sugar, which comes with all sorts of
|
||||
// candy (performance benefits). Don't believe me? Directly to source https://github.com/ziglang/zig/pull/21367
|
||||
|
|
Loading…
Reference in New Issue
Block a user