From c18ad7883259435cc61045e38129d61b39daca6c Mon Sep 17 00:00:00 2001 From: Fergus Baker Date: Sat, 17 Sep 2022 19:27:13 +0100 Subject: typo and type fixes in comment --- exercises/082_anonymous_structs3.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'exercises') diff --git a/exercises/082_anonymous_structs3.zig b/exercises/082_anonymous_structs3.zig index 8344321..e5c6839 100644 --- a/exercises/082_anonymous_structs3.zig +++ b/exercises/082_anonymous_structs3.zig @@ -4,8 +4,8 @@ // // .{ // false, -// @as(u32, 15); -// @as(i64, 67.12); +// @as(u32, 15), +// @as(f64, 67.12) // } // // We call these "tuples", which is a term used by many -- cgit v1.2.3-70-g09d2 From f2a4209f6d6b39e148e3e47aa3237ae02c8cadb8 Mon Sep 17 00:00:00 2001 From: Kim SHrier Date: Mon, 7 Nov 2022 00:28:40 -0700 Subject: Exercise 60: mention new float type f80 --- exercises/060_floats.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'exercises') diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index a223257..237e9c6 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -1,7 +1,7 @@ // // Zig has support for IEEE-754 floating-point numbers in these -// specific sizes: f16, f32, f64, f128. Floating point literals -// may be writen in scientific notation: +// specific sizes: f16, f32, f64, f80, and f128. Floating point +// literals may be writen in scientific notation: // // const a1: f32 = 1200.0; // 1,200 // const a2: f32 = 1.2e+3; // 1,200 -- cgit v1.2.3-70-g09d2 From b08233eafe2985a2890a47c52e431c63521ff381 Mon Sep 17 00:00:00 2001 From: Leandro Motta Barros Date: Thu, 29 Dec 2022 21:17:40 -0300 Subject: Fix typo: "written", not "writen" --- exercises/060_floats.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'exercises') diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index a223257..e13a216 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -1,7 +1,7 @@ // // Zig has support for IEEE-754 floating-point numbers in these // specific sizes: f16, f32, f64, f128. Floating point literals -// may be writen in scientific notation: +// may be written in scientific notation: // // const a1: f32 = 1200.0; // 1,200 // const a2: f32 = 1.2e+3; // 1,200 -- cgit v1.2.3-70-g09d2 From 1891030f4980410d13a26ff1a15e8097448802be Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Thu, 12 Jan 2023 19:25:06 +0100 Subject: Update 042_pointers4.zig https://github.com/ratfactor/ziglings/pull/122 --- exercises/042_pointers4.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'exercises') diff --git a/exercises/042_pointers4.zig b/exercises/042_pointers4.zig index 359a2f1..1f6db70 100644 --- a/exercises/042_pointers4.zig +++ b/exercises/042_pointers4.zig @@ -17,7 +17,7 @@ pub fn main() void { var num: u8 = 1; var more_nums = [_]u8{ 1, 1, 1, 1 }; - // Let's pass a reference to num to our function and print it: + // Let's pass the num reference to our function and print it: makeFive(&num); std.debug.print("num: {}, ", .{num}); -- cgit v1.2.3-70-g09d2 From 543d0ba585c8f61ed24f64d41b0e776e7c597455 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 12:25:57 +0100 Subject: fixed https://github.com/ratfactor/ziglings/issues/156 --- exercises/064_builtins.zig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'exercises') diff --git a/exercises/064_builtins.zig b/exercises/064_builtins.zig index 1a0d263..85d1aa7 100644 --- a/exercises/064_builtins.zig +++ b/exercises/064_builtins.zig @@ -38,14 +38,12 @@ pub fn main() void { // Let's try it with a tiny 4-bit integer size to make it clear: const a: u4 = 0b1101; const b: u4 = 0b0101; - var my_result: u4 = undefined; - var overflowed: bool = undefined; - overflowed = @addWithOverflow(u4, a, b, &my_result); + const my_result = @addWithOverflow(a, b); // Check out our fancy formatting! b:0>4 means, "print // as a binary number, zero-pad right-aligned four digits." // The print() below will produce: "1101 + 0101 = 0010 (true)". - print("{b:0>4} + {b:0>4} = {b:0>4} ({})", .{ a, b, my_result, overflowed }); + print("{b:0>4} + {b:0>4} = {b:0>4} ({s})", .{ a, b, my_result[0], if (my_result[1] == 1) "true" else "false" }); // Let's make sense of this answer. The value of 'b' in decimal is 5. // Let's add 5 to 'a' but go one by one and see where it overflows: -- cgit v1.2.3-70-g09d2 From f0d43f488f434c1df2f5395d2b8afc35b15d1797 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 15:36:36 +0100 Subject: patch because of a change in @typeInfo --- exercises/065_builtins2.zig | 2 +- exercises/071_comptime6.zig | 2 +- exercises/082_anonymous_structs3.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'exercises') diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index a0f9160..7d3e770 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -100,7 +100,7 @@ pub fn main() void { // // pub const StructField = struct { // name: []const u8, - // field_type: type, + // type: type, // default_value: anytype, // is_comptime: bool, // alignment: comptime_int, diff --git a/exercises/071_comptime6.zig b/exercises/071_comptime6.zig index f764590..7723291 100644 --- a/exercises/071_comptime6.zig +++ b/exercises/071_comptime6.zig @@ -41,7 +41,7 @@ pub fn main() void { const fields = @typeInfo(Narcissus).Struct.fields; ??? { - if (field.field_type != void) { + if (field.type != void) { print(" {s}", .{field.name}); } } diff --git a/exercises/082_anonymous_structs3.zig b/exercises/082_anonymous_structs3.zig index e5c6839..6760ff3 100644 --- a/exercises/082_anonymous_structs3.zig +++ b/exercises/082_anonymous_structs3.zig @@ -96,7 +96,7 @@ fn printTuple(tuple: anytype) void { // // pub const StructField = struct { // name: []const u8, - // field_type: type, + // type: type, // default_value: anytype, // is_comptime: bool, // alignment: comptime_int, -- cgit v1.2.3-70-g09d2 From d59c3e95983a83c65b549bf41500206681233ee3 Mon Sep 17 00:00:00 2001 From: Roman FroĊ‚ow Date: Tue, 17 Jan 2023 23:24:32 +0100 Subject: writen -> written --- exercises/060_floats.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'exercises') diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index 237e9c6..8ba51db 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -1,7 +1,7 @@ // // Zig has support for IEEE-754 floating-point numbers in these // specific sizes: f16, f32, f64, f80, and f128. Floating point -// literals may be writen in scientific notation: +// literals may be written in scientific notation: // // const a1: f32 = 1200.0; // 1,200 // const a2: f32 = 1.2e+3; // 1,200 -- cgit v1.2.3-70-g09d2