15 Commits

Author SHA1 Message Date
Chris Boesch 151450cc7d Merge pull request 'minor fixes' (#470) from minor-fixes into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/470
2026-06-21 16:48:15 +02:00
Chris Boesch cbcb570248 expanded explanation about self vs *self 2026-06-21 16:16:31 +02:00
Chris Boesch f3df08d8e0 fixed description 2026-06-21 15:43:28 +02:00
Chris Boesch 1ad3534e4d fixed grammar 2026-06-21 15:31:18 +02:00
Chris Boesch 894ebf1a37 Merge pull request 'Use significand terminology' (#465) from FilipKubis/ziglings:significand-consistent-naming into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/465
2026-06-21 14:24:14 +02:00
Chris Boesch 50d699df57 Merge pull request 'fix typos in CONTRIBUTING.md' (#461) from tariq/exercises:fix-typo-contributing-md into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/461
2026-06-21 13:42:56 +02:00
Chris Boesch 272ab59937 Merge pull request 'Fixed a couple of exercise references as they are no longer accurate after the recent changes' (#457) from killyosaur/zigling-exercises:fixing-exercise-references into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/457
2026-06-21 13:12:01 +02:00
Chris Boesch bfd3d013e0 Merge pull request 'Fixed typo: "you will wish" -> "you wish"' (#455) from xaviii/exercises:xaviii-typo into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/455
2026-06-21 12:49:02 +02:00
Chris Boesch 66de1124bc Merge pull request 'fix typo' (#452) from mmsaki/exercises:114-typo into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/452
2026-06-21 12:37:21 +02:00
Filip Kubiš 2cf2a885fd Use significand terminology
As exercise 60 says: Donald Knuth would not be happy with us calling
this mantissa. Proposing to use the less amiguous term significand
2026-06-20 11:18:05 +02:00
Tariq Ibrahim 90f847e8b9 fix typos in CONTRIBUTING.md
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
2026-06-13 17:28:48 -07:00
Michael Walker c24a170ca8 missed a change to add the phrase 'and quiz 95' to the statement regarding Zig's Io interface. 2026-06-11 09:59:17 -04:00
Michael Walker bc443a1113 Fixed a couple of exercise references as they are no longer accurate after the recent changes
- Exercise 107 claimed the async exercises are 84-91, they are actually 85-94 and quiz 95
- Exercise 113 claimed the bit manip exercise is 097, it is now 100
- Exercise 114 has the bit manipulation exercises as 097 and 098, they are now 100 and 101
- Exercise 114 has the last switch exercise as being 108, it is now 111.
2026-06-11 09:58:17 -04:00
xaviii d39241a20e Fixed typo: "you will wish" -> "you wish" 2026-06-09 08:54:40 +02:00
mmsaki 1891f99502 fix typo 2026-06-08 05:55:17 +02:00
9 changed files with 32 additions and 14 deletions
+2 -2
View File
@@ -8,11 +8,11 @@ of Ziglings Maintenance!
Ziglings is intended for programmers of all experience levels. No Ziglings is intended for programmers of all experience levels. No
specific language knowledge is expected. Anyone who can install specific language knowledge is expected. Anyone who can install
the current Zig snapshot, setup a copy of Ziglings, and knows the current Zig snapshot, set up a copy of Ziglings, and knows
common language building blocks (if/then/else, loops, and common language building blocks (if/then/else, loops, and
functions) is ready for Ziglings. functions) is ready for Ziglings.
Zigling's excercises are self-contained. If you can't solve Zigling's exercises are self-contained. If you can't solve
an exercise from the information you've gleaned so far from an exercise from the information you've gleaned so far from
Ziglings, then the exercise probably needs some additional work. Ziglings, then the exercise probably needs some additional work.
Please file an issue! Please file an issue!
+1 -1
View File
@@ -1,6 +1,6 @@
// //
// As with integers, you can pass a pointer to a struct when you // As with integers, you can pass a pointer to a struct when you
// will wish to modify that struct. Pointers are also useful when // wish to modify that struct. Pointers are also useful when
// you need to store a reference to a struct (a "link" to it). // you need to store a reference to a struct (a "link" to it).
// //
// const Vertex = struct{ x: u32, y: u32, z: u32 }; // const Vertex = struct{ x: u32, y: u32, z: u32 };
+18
View File
@@ -37,6 +37,24 @@
// self, others use a lowercase version of the type name, but feel // self, others use a lowercase version of the type name, but feel
// free to use whatever is most appropriate. // free to use whatever is most appropriate.
// //
// "But hold on," you say, eyeing a() and b() suspiciously, "why
// does one take 'self' and another take '*self'?" Sharp eye!
//
// It all comes down to a single question: does the function need
// to CHANGE the struct?
//
// * Needs to change it? Take a pointer (*Bar). Without it you'd
// be scribbling on a COPY, and your changes would evaporate the
// instant the function returns. Poof.
// * Only reads it? Plain Bar is just fine.
// (For a big, bulky struct you might still write *const Bar to
// avoid copying it around, but for small ones a copy is cheap.)
//
// You'll see this below: zap() takes 'self: HeatRay' by value
// because it only reads the ray's damage, but it takes the alien
// as '*Alien' because zapping is supposed to HURT - and that means
// changing the alien's health for real, not on a throwaway copy.
//
// Okay, you're armed. // Okay, you're armed.
// //
// Now, please zap the alien structs until they're all gone or // Now, please zap the alien structs until they're all gone or
+1 -1
View File
@@ -1,5 +1,5 @@
// //
// In Exercises 84-91, we learned about Zig's Io interface for // In Exercises 85-94 and quiz 95, we learned about Zig's Io interface for
// concurrent execution: io.async(), Group, Select, and Futures. // concurrent execution: io.async(), Group, Select, and Futures.
// Under the hood, the Threaded backend manages a pool of real // Under the hood, the Threaded backend manages a pool of real
// OS threads for you - including scheduling, cancellation, and // OS threads for you - including scheduling, cancellation, and
+1 -1
View File
@@ -46,7 +46,7 @@
// 1,000,000,000 partial values. And for each additional digit we have to // 1,000,000,000 partial values. And for each additional digit we have to
// add a zero. // add a zero.
// Even fast computers - and I mean really fast computers - get a bit warmer // Even fast computers - and I mean really fast computers - get a bit warmer
// on the CPU when it comes to really many digits. But the 8 digits are // on the CPU when it comes to a large number of digits. But 8 digits are
// enough for us for now, because we want to understand the principle and // enough for us for now, because we want to understand the principle and
// nothing more, right? // nothing more, right?
// //
+1 -1
View File
@@ -14,7 +14,7 @@
// //
// A common activity in microcontroller programming is setting and clearing // A common activity in microcontroller programming is setting and clearing
// bits on input and output pins. This lets you control LEDs, sensors, motors // bits on input and output pins. This lets you control LEDs, sensors, motors
// and more! In a previous exercise (097_bit_manipulation.zig) you learned how // and more! In a previous exercise (100_bit_manipulation.zig) you learned how
// to swap two bytes using the ^ (XOR - exclusive or) operator. This quiz will // to swap two bytes using the ^ (XOR - exclusive or) operator. This quiz will
// test your knowledge of bit manipulation in Zig while giving you a taste of // test your knowledge of bit manipulation in Zig while giving you a taste of
// what it's like to control registers in a real microcontroller. Included at // what it's like to control registers in a real microcontroller. Included at
+2 -2
View File
@@ -1,6 +1,6 @@
// //
// We've already learned plenty about bit manipulation using bitwise operations // We've already learned plenty about bit manipulation using bitwise operations
// in exercises 097 and 098 and in quiz 110. The techniques we already know work // in exercises 100 and 101 and in quiz 113. The techniques we already know work
// just fine, but creating masks and shifting individual bits around can become // just fine, but creating masks and shifting individual bits around can become
// quite tedious and unwieldy pretty quickly. // quite tedious and unwieldy pretty quickly.
// What if there was a better, a more convenient way to control individual bits? // What if there was a better, a more convenient way to control individual bits?
@@ -78,7 +78,7 @@ const FLG = packed struct(u8) {
content_checksum: bool, content_checksum: bool,
content_size: bool, content_size: bool,
block_checksum: bool, block_checksum: bool,
block_indepencence: bool, block_independence: bool,
version: u2, version: u2,
}; };
+3 -3
View File
@@ -1,5 +1,5 @@
// //
// We've already learned about switch statements in exercises 030, 031 and 108. // We've already learned about switch statements in exercises 030, 031 and 111.
// They also work with packed containers: // They also work with packed containers:
const S = packed struct(u2) { const S = packed struct(u2) {
@@ -51,11 +51,11 @@ comptime {
// //
// Try to make the float below negative: // Try to make the float below negative:
/// IEEE 754 half precision float // IEEE 754 binary16 floating-point format
const Float = packed union(u16) { const Float = packed union(u16) {
value: f16, value: f16,
bits: packed struct(u16) { bits: packed struct(u16) {
mantissa: u10, significand: u10,
exponent: u5, exponent: u5,
sign: u1, sign: u1,
}, },
+3 -3
View File
@@ -1,6 +1,6 @@
--- exercises/047_methods.zig 2023-10-03 22:15:22.122241138 +0200 --- exercises/047_methods.zig 2026-06-21 16:11:59.110876971 +0200
+++ answers/047_methods.zig 2023-10-05 20:04:07.056100214 +0200 +++ answers/047_methods.zig 2026-06-21 16:13:07.066363558 +0200
@@ -88,7 +88,7 @@ @@ -106,7 +106,7 @@
for (&aliens) |*alien| { for (&aliens) |*alien| {
// *** Zap the alien with the heat ray here! *** // *** Zap the alien with the heat ray here! ***