changed 1 to 42 for better understanding

This commit is contained in:
Chris Boesch 2025-11-28 14:42:58 +01:00
parent ed9694e557
commit 757826d45a
No known key found for this signature in database
GPG Key ID: 8712DF4D3E364668
3 changed files with 10 additions and 10 deletions

View File

@ -730,7 +730,7 @@ const exercises = [_]Exercise{
}, },
.{ .{
.main_file = "009_if.zig", .main_file = "009_if.zig",
.output = "Foo is 1!", .output = "Foo is 42!",
}, },
.{ .{
.main_file = "010_if2.zig", .main_file = "010_if2.zig",

View File

@ -21,13 +21,13 @@
const std = @import("std"); const std = @import("std");
pub fn main() void { pub fn main() void {
const foo = 1; const foo = 42;
// Please fix this condition: // Please fix this condition:
if (foo) { if (foo) {
// We want our program to print this message! // We want our program to print this message!
std.debug.print("Foo is 1!\n", .{}); std.debug.print("Foo is 42!\n", .{});
} else { } else {
std.debug.print("Foo is not 1!\n", .{}); std.debug.print("Foo is not 42!\n", .{});
} }
} }

View File

@ -1,11 +1,11 @@
--- exercises/009_if.zig 2023-10-03 22:15:22.122241138 +0200 --- exercises/009_if.zig 2025-11-28 14:40:19.301738185 +0100
+++ answers/009_if.zig 2023-10-05 20:04:06.882763636 +0200 +++ answers/009_if.zig 2025-11-28 14:39:07.756077340 +0100
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
const foo = 1; const foo = 42;
// Please fix this condition: // Please fix this condition:
- if (foo) { - if (foo) {
+ if (foo == 1) { + if (foo == 42) {
// We want our program to print this message! // We want our program to print this message!
std.debug.print("Foo is 1!\n", .{}); std.debug.print("Foo is 42!\n", .{});
} else { } else {