12 Commits

Author SHA1 Message Date
Chris Boesch f39b462659 Merge pull request 'fixed formatting error' (#496) from format_error into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/496
2026-07-21 21:06:57 +02:00
Chris Boesch a2eee9d52f fixed formatting error 2026-07-21 20:54:27 +02:00
Chris Boesch 248093a2de Merge pull request '026 thier to their' (#489) from geoffreygordonashbrook/ziglings_exercises_fork:main into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/489
2026-07-05 22:51:52 +02:00
lineality 004ea3b3ae 026 thier to their 2026-07-05 13:32:37 -04:00
Chris Boesch c85daab1a1 Merge pull request 'rivendell: Remove the resetLine function' (#488) from manliop/exercises:remove-resetLine into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/488
2026-07-02 23:56:15 +02:00
Manlio Perillo f6c3e4edc4 rivendell: Remove the resetLine function
This was necessary in the past (commit 30db9d, 2023-04-17).

The new Progress.zig and, probably, the fact that exercises run on a
separate executable solved the problem.
2026-07-02 15:07:51 +02:00
Chris Boesch a5ed7b636b Merge pull request 'added explanation about stdout' (#487) from i481-stdout-explanation into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/487
2026-07-01 16:32:38 +02:00
Chris Boesch ba99eea43b created also new patch file 2026-07-01 16:28:04 +02:00
Chris Boesch 708436c63d added explanation about stdout 2026-07-01 16:20:41 +02:00
Chris Boesch e65b359055 Merge pull request 'Added comment to help run exercize 108_threading2.zig with the ReleaseFast flag.' (#482) from atici/ziglings-exercises:main into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/482
2026-07-01 16:11:19 +02:00
atici 719f7f0740 removed weird characters 2026-07-01 16:29:20 +03:00
atici 9a1ff49206 Added comment to help run exercize 108 with the ReleaseFast flag. 2026-06-30 11:33:03 +02:00
5 changed files with 25 additions and 14 deletions
+8
View File
@@ -30,3 +30,11 @@ pub fn main(init: std.process.Init) !void {
// We just learned of a single statement which can accomplish this.
stdout.print("Hello world!\n", .{});
}
// Now you must be thinking "Why would I need to do this instead of good
// old 'std.debug.print()'?", but here's what you need to understand:
// 'std.debug.print()' prints its output to stderr, while the stdout_writer
// approach prints to stdout.
// A common practice is to pipe output of a command to other commands,
// and in order for the piping to work, those commands expect their input
// to come from stdout, not stderr.
+5
View File
@@ -104,6 +104,11 @@ fn thread_pi(pi: *f64, begin: u64, count: u64) !void {
// is created. Otherwise the debug functions slow down the speed
// to such an extent that seconds become minutes during execution.
//
// You can use the following command to build and run this
// exercise with the "ReleaseFast" flag:
//
// zig run exercises/108_threading2.zig -O ReleaseFast
//
// And you should remove the formatting restriction in "print",
// otherwise you will not be able to see the additional digits.
//
+5 -3
View File
@@ -1,9 +1,11 @@
--- exercises/026_hello2.zig 2026-01-09 22:51:45.803358789 +0100
+++ answers/026_hello2.zig 2026-01-09 22:50:46.016166527 +0100
@@ -28,5 +28,5 @@
--- exercises/026_hello2.zig 2026-07-01 16:27:18.674459266 +0200
+++ answers/026_hello2.zig 2026-07-01 16:27:08.579220702 +0200
@@ -28,7 +28,7 @@
// to be able to pass it up as a return value of main().
//
// We just learned of a single statement which can accomplish this.
- stdout.print("Hello world!\n", .{});
+ try stdout.print("Hello world!\n", .{});
}
// Now you must be thinking "Why would I need to do this instead of good
+7 -5
View File
@@ -1,5 +1,5 @@
--- exercises/036_enums2.zig 2023-10-03 22:15:22.122241138 +0200
+++ answers/036_enums2.zig 2023-10-05 20:04:07.002765884 +0200
--- exercises/036_enums2.zig 2026-07-21 20:48:50.596099259 +0200
+++ answers/036_enums2.zig 2026-07-21 20:50:14.726826859 +0200
@@ -31,7 +31,7 @@
const Color = enum(u32) {
red = 0xff0000,
@@ -18,9 +18,11 @@
\\</p>
\\
, .{
@intFromEnum(Color.red),
@intFromEnum(Color.green),
- @intFromEnum(Color.red),
- @intFromEnum(Color.green),
- @intFromEnum(???), // Oops! We're missing something!
+ @intFromEnum(Color.blue), // Oops! We're missing something!
+ @backingInt(Color.red),
+ @backingInt(Color.green),
+ @backingInt(Color.blue), // Oops! We're missing something!
});
}
-6
View File
@@ -359,7 +359,6 @@ fn runExe(ctx: Context, ex: Exercise) !void {
return err;
};
resetLine();
print("Checking {s}...\n", .{ex.main_file});
return checkOutput(io, arena, ex, result);
@@ -392,7 +391,6 @@ fn runTest(ctx: Context, ex: Exercise) !void {
return err;
};
resetLine();
print("Checking {s}...\n", .{ex.main_file});
return checkTest(ex, result);
@@ -486,10 +484,6 @@ fn help(ex: Exercise, mode: Mode) void {
});
}
fn resetLine() void {
if (stderr_term_mode == .escape_codes) print("{s}", .{"\x1b[2K\r"});
}
// Removes trailing whitespace per line and any trailing LF at the end.
fn trimLines(arena: std.mem.Allocator, buf: []const u8) ![]const u8 {
var list = try std.ArrayList(u8).initCapacity(arena, buf.len);