aboutsummaryrefslogtreecommitdiff
path: root/exercises/065_builtins2.zig
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-11-07 20:52:39 -0500
committerDave Gauer <dave@ratfactor.com>2021-11-07 20:52:39 -0500
commitd1e684126176214b65399034c96b6f52189b2b72 (patch)
tree5866b7f3a15945a73b946443fbd490fc8f4cc2d8 /exercises/065_builtins2.zig
parent266449b1dd8e5e89887aa84c2d10270cdd6c7936 (diff)
parentdedd787f2dd0badc03caa1299adaf57eaeaae156 (diff)
downloadziglings-d1e684126176214b65399034c96b6f52189b2b72.tar.gz
ziglings-d1e684126176214b65399034c96b6f52189b2b72.tar.bz2
ziglings-d1e684126176214b65399034c96b6f52189b2b72.tar.xz
ziglings-d1e684126176214b65399034c96b6f52189b2b72.zip
Merge branch 'main' of github.com:ratfactor/ziglings into main
Diffstat (limited to 'exercises/065_builtins2.zig')
-rw-r--r--exercises/065_builtins2.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig
index ef41797..1532c2a 100644
--- a/exercises/065_builtins2.zig
+++ b/exercises/065_builtins2.zig
@@ -1,7 +1,7 @@
//
// Zig has builtins for mathematical operations such as...
//
-// @sqrt @sin @cos
+// @sqrt @sin @cos
// @exp @log @floor
//
// ...and lots of type casting operations such as...
@@ -20,18 +20,18 @@
// by exploring just THREE of Zig's MANY introspection abilities:
//
// 1. @This() type
-//
+//
// Returns the innermost struct, enum, or union that a function
// call is inside.
//
// 2. @typeInfo(comptime T: type) @import("std").builtin.TypeInfo
-//
+//
// Returns information about any type in a TypeInfo union which
// will contain different information depending on which type
// you're examining.
-//
+//
// 3. @TypeOf(...) type
-//
+//
// Returns the type common to all input parameters (each of which
// may be any expression). The type is resolved using the same
// "peer type resolution" process the compiler itself uses when
@@ -46,14 +46,14 @@ const Narcissus = struct {
me: *Narcissus = undefined,
myself: *Narcissus = undefined,
echo: void = undefined,
-
+
fn fetchTheMostBeautifulType() type {
return @This();
}
};
pub fn main() void {
- var narcissus: Narcissus = Narcissus {};
+ var narcissus: Narcissus = Narcissus{};
// Oops! We cannot leave the 'me' and 'myself' fields
// undefined. Please set them here:
@@ -70,7 +70,7 @@ pub fn main() void {
// fix this call:
const T2 = narcissus.fetchTheMostBeautifulType();
- print("A {} loves all {}es. ", .{T1, T2});
+ print("A {} loves all {}es. ", .{ T1, T2 });
// His final words as he was looking in
// those waters he habitually watched